Fix 'no such column: deezer_artist_id' on watchlist artist config GET

The library-enrichment query inside /api/watchlist/artist/<id>/config
queries the `artists` table but used the column names from the
watchlist_artists table:

  WHERE spotify_artist_id = ? OR itunes_artist_id = ?
        OR deezer_artist_id = ? OR discogs_artist_id = ?

The `artists` table actually uses `deezer_id` and `discogs_id` for
those two columns (only `watchlist_artists` uses the `_artist_id`
suffix). The mismatch threw `no such column: deezer_artist_id` on
every config GET, which was caught by the surrounding try/except and
logged — releases came back empty and Spotify/genres etc. fell back
to defaults.

Visible side effects: the request that LOOKED slow ('1420.2ms') and
the recurring ERROR line in app.log every time a watchlist artist
overlay opened.

Watchlist-config GET now returns proper banner_url / summary / style
/ mood / label / genres for Deezer- and Discogs-source artists too.
The other watchlist queries in this endpoint (42302 / 42315 / 42379)
correctly target watchlist_artists and stay as-is.
pull/361/head
Broque Thomas 2 months ago
parent b0a07f993a
commit adcfd2db70

@ -42190,10 +42190,14 @@ def watchlist_artist_config(artist_id):
try:
conn2 = sqlite3.connect(str(database.database_path))
cur2 = conn2.cursor()
# The library `artists` table uses `deezer_id` / `discogs_id` for
# those columns; only the `watchlist_artists` table uses the
# `_artist_id` suffix for them. Mixing them was producing a
# 'no such column' on every watchlist-config GET.
cur2.execute("""
SELECT banner_url, summary, style, mood, label, genres
FROM artists
WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_artist_id = ? OR discogs_artist_id = ?
WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_id = ? OR discogs_id = ?
LIMIT 1
""", (artist_id, artist_id, artist_id, artist_id))
lib_row = cur2.fetchone()

Loading…
Cancel
Save