From 2552f0787d3fd7455a5effbce09e5b54f7f5ac9f Mon Sep 17 00:00:00 2001 From: RemixDev Date: Fri, 5 Jun 2020 19:35:51 +0200 Subject: [PATCH] Keep "Various Aritsts" tag only if it's the only artist in the track This fixes #21 --- deemix/app/downloader.py | 2 +- deemix/utils/taggers.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index ca26123..2ae1094 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -335,7 +335,7 @@ def getTrackData(dz, trackAPI_gw, trackAPI=None, albumAPI_gw=None, albumAPI=None track['artist'] = {} track['artists'] = [] for artist in trackAPI['contributors']: - if artist['id'] != 5080: + if artist['id'] != 5080 or artist['id'] == 5080 and len(trackAPI['contributors']) == 1: track['artists'].append(artist['name']) if not artist['role'] in track['artist']: track['artist'][artist['role']] = [] diff --git a/deemix/utils/taggers.py b/deemix/utils/taggers.py index cbda646..af92e47 100644 --- a/deemix/utils/taggers.py +++ b/deemix/utils/taggers.py @@ -13,7 +13,7 @@ def tagID3(stream, track, save): if save['title']: tag.add(TIT2(text=track['title'])) - if save['artist']: + if save['artist'] and len(track['artists']): if save['multitagSeparator'] != "default": tag.add(TPE1(text=track['artistsString'])) tag.add(TXXX(desc="ARTISTS", text=track['artists'])) @@ -21,7 +21,7 @@ def tagID3(stream, track, save): tag.add(TPE1(text=track['artists'])) if save['album']: tag.add(TALB(text=track['album']['title'])) - if save['albumArtist']: + if save['albumArtist'] and len(track['album']['artists']): tag.add(TPE2(text=track['album']['artists'])) if save['trackNumber']: tag.add(TRCK( @@ -79,7 +79,7 @@ def tagFLAC(stream, track, save): tag.clear_pictures() if save['title']: tag["TITLE"] = track['title'] - if save['artist']: + if save['artist'] and len(track['artists']): if save['multitagSeparator'] != "default": tag["ARTIST"] = track['artistsString'] tag["ARTISTS"] = track['artists'] @@ -87,7 +87,7 @@ def tagFLAC(stream, track, save): tag["ARTIST"] = track['artists'] if save['album']: tag["ALBUM"] = track['album']['title'] - if save['albumArtist']: + if save['albumArtist'] and len(track['album']['artists']): tag["ALBUMARTIST"] = track['album']['artists'] if save['trackNumber']: tag["TRACKNUMBER"] = str(track['trackNumber'])