From 4f04887931dd745a5e2e17543fbdcab9db75e5b8 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sun, 1 Mar 2020 11:52:29 +0100 Subject: [PATCH] Implemented null separator and id3v1 settings --- deemix/app/downloader.py | 2 +- deemix/utils/taggers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index b612b81..710a8db 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -328,7 +328,7 @@ def downloadTrackObj(trackAPI, settings, overwriteBitrate=False, extraTrack=None print("ERROR: Track not available on deezer's servers!") return False if track['selectedFormat'] in [3, 1, 8]: - tagID3(writepath, track, settings['tags']) + tagID3(writepath, track, settings['tags'], settings['saveID3v1'], settings['useNullSeparator']) elif track['selectedFormat'] == 9: tagFLAC(writepath, track, settings['tags']) print("Done!") diff --git a/deemix/utils/taggers.py b/deemix/utils/taggers.py index 9a9dd0c..cf797c7 100644 --- a/deemix/utils/taggers.py +++ b/deemix/utils/taggers.py @@ -4,7 +4,7 @@ from mutagen.id3 import ID3, ID3NoHeaderError, TXXX, TIT2, TPE1, TALB, TPE2, TRC TPUB, TSRC, USLT, APIC, IPLS, TCOM, TCOP -def tagID3(stream, track, save): +def tagID3(stream, track, save, id3v1=False, nullSeparator=True): try: tag = ID3(stream) except ID3NoHeaderError: @@ -58,7 +58,7 @@ def tagID3(stream, track, save): with open(track['album']['picPath'], 'rb') as f: tag.add(APIC(3, 'image/jpeg' if track['album']['picPath'].endswith('jpg') else 'image/png', 3, data=f.read())) - tag.save(stream, v1=2, v2_version=3, v23_sep=None) + tag.save(stream, v1=2 if id3v1 else 0, v2_version=3, v23_sep=None if nullSeparator else '/') def tagFLAC(stream, track, save):