From 0f5d3f597ae47204a3353eb646d26bf21266eca1 Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Tue, 31 Mar 2026 12:32:32 -0400 Subject: [PATCH] still getting extra artists. need to test on my deployment --- src/tagger.rs | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/tagger.rs b/src/tagger.rs index 881fd56..45abbba 100644 --- a/src/tagger.rs +++ b/src/tagger.rs @@ -94,23 +94,20 @@ pub async fn tag_track( ); } - // Use existing artist_id if already set (e.g., from download pipeline). - // Only upsert from MB when the track has no artist association yet. - let artist_id = if track.artist_id.is_some() { - track.artist_id - } else { - match &details.artist_mbid { - Some(mbid) => Some( - queries::artists::upsert(conn, &details.artist, Some(mbid)) - .await? - .id, - ), - None => Some( - queries::artists::upsert(conn, &details.artist, None) - .await? - .id, - ), - } + // Always resolve artist_id from MB data — this is the authoritative source for the + // primary artist. The indexer or download worker may have set artist_id to a collaborator + // artist (e.g., "Bass Drum of Death, Not Documented"), so we always correct it here. + let artist_id = match &details.artist_mbid { + Some(mbid) => Some( + queries::artists::upsert(conn, &details.artist, Some(mbid)) + .await? + .id, + ), + None => Some( + queries::artists::upsert(conn, &details.artist, None) + .await? + .id, + ), }; // Upsert album from best release