Moved the db

This commit is contained in:
Connor Johnstone
2026-03-03 13:10:37 -05:00
parent ba094a5dc5
commit f5f0273853
3 changed files with 23 additions and 10 deletions

View File

@@ -2,18 +2,19 @@
"""Fuzzy search artists in playlists.db and show their similar artists."""
import curses
import os
import sqlite3
import sys
from pathlib import Path
def find_db():
"""Look for playlists.db in cwd, then script's parent dir."""
for base in [Path.cwd(), Path(__file__).resolve().parent.parent]:
p = base / "playlists.db"
if p.exists():
return str(p)
print("Could not find playlists.db", file=sys.stderr)
"""Find playlists.db in XDG data dir."""
data_home = os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")
p = Path(data_home) / "playlists" / "playlists.db"
if p.exists():
return str(p)
print(f"Could not find {p}", file=sys.stderr)
sys.exit(1)