From 7fb4cf6b0ecd3a3558d9a79495600827636b62ca Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sat, 11 Apr 2026 18:31:11 -0700 Subject: [PATCH] Use per-track artist in tag writer for compilations and DJ mixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tag preview and writer now use track_artist (per-track artist) for the Artist tag when available, falling back to artist_name (album artist) when NULL. Album Artist tag always uses artist_name. Fixes #277 — DJ mix albums no longer overwrite per-track artists (Technique, Gouryella) with the album artist (Tiësto). --- core/tag_writer.py | 8 ++++++-- web_server.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/tag_writer.py b/core/tag_writer.py index 71bf3b86..09bf611a 100644 --- a/core/tag_writer.py +++ b/core/tag_writer.py @@ -143,6 +143,10 @@ def build_tag_diff(file_tags: Dict[str, Any], db_data: Dict[str, Any]) -> List[D file_val = file_tags.get(file_key) db_val = db_data.get(db_key) + # Special: use per-track artist for Artist field when available (DJ mixes, compilations) + if file_key == 'artist' and db_data.get('track_artist'): + db_val = db_data['track_artist'] + # Normalize for comparison file_str = _normalize_for_compare(file_val) db_str = _normalize_for_compare(db_val) @@ -230,9 +234,9 @@ def write_tags_to_file(file_path: str, db_data: Dict[str, Any], # Build metadata dict from DB data title = db_data.get('title') - artist = db_data.get('artist_name') + artist = db_data.get('track_artist') or db_data.get('artist_name') # Per-track artist for compilations/DJ mixes album = db_data.get('album_title') - album_artist = db_data.get('artist_name') # Use artist name as album artist + album_artist = db_data.get('artist_name') # Album artist stays as the album-level artist year = db_data.get('year') genres = db_data.get('genres') track_num = db_data.get('track_number') diff --git a/web_server.py b/web_server.py index d81d1984..260a4f0e 100644 --- a/web_server.py +++ b/web_server.py @@ -11944,6 +11944,7 @@ def get_track_tag_preview(track_id): db_data = { 'title': track_data.get('title'), 'artist_name': track_data.get('artist_name'), + 'track_artist': track_data.get('track_artist'), 'album_title': track_data.get('album_title'), 'year': track_data.get('year'), 'genres': album_genres,