Hardened the indexing for blink-182

This commit is contained in:
Connor Johnstone
2026-03-03 13:30:51 -05:00
parent f5f0273853
commit 60a1d704dd
4 changed files with 104 additions and 26 deletions

View File

@@ -21,7 +21,9 @@ def find_db():
def load_artists(db_path):
conn = sqlite3.connect(db_path)
rows = conn.execute(
"SELECT mbid, COALESCE(name, mbid) FROM artists ORDER BY name"
"SELECT a.mbid, COALESCE(a.name, a.mbid) FROM artists a "
"LEFT JOIN tracks t ON t.artist_mbid = a.mbid "
"GROUP BY a.mbid ORDER BY COUNT(t.path) DESC, a.name"
).fetchall()
conn.close()
return rows # [(mbid, display_name), ...]