Add Discogs to watchlist UI — badges, provider section, config endpoint

- Watchlist artist list: discogs_artist_id in API response
- Watchlist source badges: Discogs badge on artist cards
- Watchlist config modal: discogs_artist_id in SQL query, WHERE clause,
  response, and linked provider section with badge
- CSS for watchlist-source-discogs and watchlist-provider-badge.discogs
This commit is contained in:
Broque Thomas 2026-04-02 21:09:11 -07:00
parent 82f9b84e5b
commit f51a8a9ee9
3 changed files with 26 additions and 7 deletions

View file

@ -36572,6 +36572,7 @@ def get_watchlist_artists():
"image_url": artist.image_url, # Cached during watchlist scans
"itunes_artist_id": artist.itunes_artist_id, # For iTunes-only artists
"deezer_artist_id": getattr(artist, 'deezer_artist_id', None),
"discogs_artist_id": getattr(artist, 'discogs_artist_id', None),
"include_albums": artist.include_albums,
"include_eps": artist.include_eps,
"include_singles": artist.include_singles,
@ -37531,10 +37532,10 @@ def watchlist_artist_config(artist_id):
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, deezer_artist_id,
lookback_days
lookback_days, discogs_artist_id
FROM watchlist_artists
WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_artist_id = ?
""", (artist_id, artist_id, artist_id))
WHERE spotify_artist_id = ? OR itunes_artist_id = ? OR deezer_artist_id = ? OR discogs_artist_id = ?
""", (artist_id, artist_id, artist_id, artist_id))
result = cursor.fetchone()
conn.close()
@ -37546,6 +37547,7 @@ def watchlist_artist_config(artist_id):
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
discogs_id = result[16] # discogs_artist_id from query
# Get artist info from Spotify (only for Spotify artists)
artist_info = None
@ -37644,6 +37646,7 @@ def watchlist_artist_config(artist_id):
"spotify_artist_id": spotify_id,
"itunes_artist_id": itunes_id,
"deezer_artist_id": deezer_id,
"discogs_artist_id": discogs_id,
"watchlist_name": result[7], # Original stored watchlist artist name
})

View file

@ -38781,6 +38781,7 @@ async function showWatchlistModal() {
if (artist.spotify_artist_id) sourceBadges.push('<span class="watchlist-source-badge watchlist-source-spotify">Spotify</span>');
if (artist.itunes_artist_id) sourceBadges.push('<span class="watchlist-source-badge watchlist-source-itunes">iTunes</span>');
if (artist.deezer_artist_id) sourceBadges.push('<span class="watchlist-source-badge watchlist-source-deezer">Deezer</span>');
if (artist.discogs_artist_id) sourceBadges.push('<span class="watchlist-source-badge watchlist-source-discogs">Discogs</span>');
const artistPrimaryId = artist.spotify_artist_id || artist.itunes_artist_id || artist.deezer_artist_id;
return `
<div class="watchlist-artist-card"
@ -38924,7 +38925,7 @@ function closeWatchlistModal() {
* Populate the linked provider section in the watchlist config modal.
* Shows which Spotify/iTunes/Deezer artist is linked and allows changing it.
*/
function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesId, artistInfo, deezerId) {
function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesId, artistInfo, deezerId, discogsId) {
const section = document.getElementById('watchlist-linked-provider-section');
const content = document.getElementById('watchlist-linked-provider-content');
if (!section || !content) return;
@ -38933,8 +38934,9 @@ function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesI
const hasSpotify = !!spotifyId;
const hasItunes = !!itunesId;
const hasDeezer = !!deezerId;
const hasDiscogs = !!discogsId;
if (!hasSpotify && !hasItunes && !hasDeezer) {
if (!hasSpotify && !hasItunes && !hasDeezer && !hasDiscogs) {
section.style.display = 'none';
return;
}
@ -38969,6 +38971,9 @@ function _populateLinkedProviderSection(artistId, artistName, spotifyId, itunesI
if (hasDeezer) {
html += `<span class="watchlist-provider-badge deezer">Deezer</span>`;
}
if (hasDiscogs) {
html += `<span class="watchlist-provider-badge discogs">Discogs</span>`;
}
html += `</div>`;
// Show mismatch warning if linked name differs from watchlist name
@ -39135,10 +39140,10 @@ async function openWatchlistArtistConfigModal(artistId, artistName) {
return;
}
const { config, artist, spotify_artist_id, itunes_artist_id, deezer_artist_id, watchlist_name } = data;
const { config, artist, spotify_artist_id, itunes_artist_id, deezer_artist_id, discogs_artist_id, watchlist_name } = data;
// Populate linked provider section (use DB watchlist_name for mismatch comparison)
_populateLinkedProviderSection(artistId, watchlist_name || artistName, spotify_artist_id, itunes_artist_id, artist, deezer_artist_id);
_populateLinkedProviderSection(artistId, watchlist_name || artistName, spotify_artist_id, itunes_artist_id, artist, deezer_artist_id, discogs_artist_id);
// Check if global override is active
let globalOverrideActive = false;

View file

@ -15244,6 +15244,11 @@ body.helper-mode-active #dashboard-activity-feed:hover {
color: #a265e6;
}
.watchlist-source-discogs {
background: rgba(212, 165, 116, 0.15);
color: #D4A574;
}
.watchlist-card-pills {
position: relative;
z-index: 2;
@ -17040,6 +17045,12 @@ body.helper-mode-active #dashboard-activity-feed:hover {
border: 1px solid rgba(162, 56, 255, 0.3);
}
.watchlist-provider-badge.discogs {
background: rgba(212, 165, 116, 0.15);
color: #D4A574;
border: 1px solid rgba(212, 165, 116, 0.3);
}
.watchlist-linked-mismatch-warning {
margin-top: 6px;
font-size: 12px;