Implemented null separator and id3v1 settings

This commit is contained in:
RemixDev 2020-03-01 11:52:29 +01:00
parent f7d8ee0d45
commit 4f04887931
2 changed files with 3 additions and 3 deletions

View File

@ -328,7 +328,7 @@ def downloadTrackObj(trackAPI, settings, overwriteBitrate=False, extraTrack=None
print("ERROR: Track not available on deezer's servers!") print("ERROR: Track not available on deezer's servers!")
return False return False
if track['selectedFormat'] in [3, 1, 8]: 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: elif track['selectedFormat'] == 9:
tagFLAC(writepath, track, settings['tags']) tagFLAC(writepath, track, settings['tags'])
print("Done!") print("Done!")

View File

@ -4,7 +4,7 @@ from mutagen.id3 import ID3, ID3NoHeaderError, TXXX, TIT2, TPE1, TALB, TPE2, TRC
TPUB, TSRC, USLT, APIC, IPLS, TCOM, TCOP TPUB, TSRC, USLT, APIC, IPLS, TCOM, TCOP
def tagID3(stream, track, save): def tagID3(stream, track, save, id3v1=False, nullSeparator=True):
try: try:
tag = ID3(stream) tag = ID3(stream)
except ID3NoHeaderError: except ID3NoHeaderError:
@ -58,7 +58,7 @@ def tagID3(stream, track, save):
with open(track['album']['picPath'], 'rb') as f: 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.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): def tagFLAC(stream, track, save):