diff --git a/web_server.py b/web_server.py index 2ed46941..93650e21 100644 --- a/web_server.py +++ b/web_server.py @@ -12153,7 +12153,8 @@ def search_match(): "name": artist.name, "image_url": getattr(artist, 'image_url', None), "genres": getattr(artist, 'genres', []), - "popularity": getattr(artist, 'popularity', 0) + "popularity": getattr(artist, 'popularity', 0), + "followers": getattr(artist, 'followers', 0) }, "confidence": confidence }) @@ -31095,20 +31096,21 @@ def watchlist_artist_config(artist_id): SELECT include_albums, include_eps, include_singles, include_live, include_remixes, include_acoustic, include_compilations, artist_name, image_url, spotify_artist_id, itunes_artist_id, - last_scan_timestamp, date_added, include_instrumentals + last_scan_timestamp, date_added, include_instrumentals, deezer_artist_id FROM watchlist_artists - WHERE spotify_artist_id = ? OR itunes_artist_id = ? - """, (artist_id, artist_id)) + WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_artist_id = ? + """, (artist_id, artist_id, artist_id)) result = cursor.fetchone() conn.close() if not result: return jsonify({"success": False, "error": "Artist not found in watchlist"}), 404 - + # Determine if this is an iTunes or Spotify artist is_itunes_artist = artist_id.isdigit() spotify_id = result[9] # spotify_artist_id from query itunes_id = result[10] # itunes_artist_id from query + deezer_id = result[14] # deezer_artist_id from query # Get artist info from Spotify (only for Spotify artists) artist_info = None @@ -31145,9 +31147,9 @@ def watchlist_artist_config(artist_id): cur2.execute(""" SELECT banner_url, summary, style, mood, label, genres FROM artists - WHERE spotify_artist_id = ? OR itunes_artist_id = ? + WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_artist_id = ? LIMIT 1 - """, (artist_id, artist_id)) + """, (artist_id, artist_id, artist_id)) lib_row = cur2.fetchone() if lib_row: artist_info['banner_url'] = lib_row[0] @@ -31167,10 +31169,10 @@ def watchlist_artist_config(artist_id): SELECT rr.album_name, rr.release_date, rr.album_cover_url, rr.track_count FROM recent_releases rr JOIN watchlist_artists wa ON rr.watchlist_artist_id = wa.id - WHERE wa.spotify_artist_id = ? OR wa.itunes_artist_id = ? + WHERE wa.spotify_artist_id = ? OR wa.itunes_artist_id = ? OR wa.deezer_artist_id = ? ORDER BY rr.release_date DESC LIMIT 6 - """, (artist_id, artist_id)) + """, (artist_id, artist_id, artist_id)) releases = [ { 'album_name': r[0], @@ -31205,6 +31207,7 @@ def watchlist_artist_config(artist_id): "recent_releases": releases, "spotify_artist_id": spotify_id, "itunes_artist_id": itunes_id, + "deezer_artist_id": deezer_id, "watchlist_name": result[7], # Original stored watchlist artist name }) @@ -31235,11 +31238,11 @@ def watchlist_artist_config(artist_id): include_live = ?, include_remixes = ?, include_acoustic = ?, include_compilations = ?, include_instrumentals = ?, updated_at = CURRENT_TIMESTAMP - WHERE spotify_artist_id = ? OR itunes_artist_id = ? + WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_artist_id = ? """, (int(include_albums), int(include_eps), int(include_singles), int(include_live), int(include_remixes), int(include_acoustic), int(include_compilations), int(include_instrumentals), - artist_id, artist_id)) + artist_id, artist_id, artist_id)) conn.commit() if cursor.rowcount == 0: diff --git a/webui/static/script.js b/webui/static/script.js index 1761338a..a56d7ed9 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -34453,9 +34453,9 @@ function closeWatchlistModal() { /** * Populate the linked provider section in the watchlist config modal. - * Shows which Spotify/iTunes artist is linked and allows changing it. + * Shows which Spotify/iTunes/Deezer artist is linked and allows changing it. */ -function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesId, artistInfo) { +function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesId, artistInfo, deezerId) { const section = document.getElementById('watchlist-linked-provider-section'); const content = document.getElementById('watchlist-linked-provider-content'); if (!section || !content) return; @@ -34463,8 +34463,9 @@ function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesI // Determine which providers are linked const hasSpotify = !!spotifyId; const hasItunes = !!itunesId; + const hasDeezer = !!deezerId; - if (!hasSpotify && !hasItunes) { + if (!hasSpotify && !hasItunes && !hasDeezer) { section.style.display = 'none'; return; } @@ -34496,6 +34497,9 @@ function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesI if (hasItunes) { html += `iTunes`; } + if (hasDeezer) { + html += `Deezer`; + } html += ``; // Show mismatch warning if linked name differs from watchlist name @@ -34570,12 +34574,14 @@ async function _searchLinkedProviderArtists(currentArtistId, watchlistName) { const img = a.image_url || ''; const genres = (a.genres || []).slice(0, 2).join(', '); const pop = a.popularity || 0; + const followers = a.followers || 0; + const popMeta = pop > 0 ? `Pop: ${pop}` : followers > 0 ? `${followers.toLocaleString()} fans` : ''; html += `