Added option for saving cover description as UTF8

This commit is contained in:
RemixDev 2020-09-19 11:06:35 +02:00
parent b0014f5219
commit 5fa251ae3a
4 changed files with 7 additions and 6 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
__version__ = "1.3.12" __version__ = "1.3.13"

View File

@ -92,7 +92,8 @@ class Settings:
"useNullSeparator": False, "useNullSeparator": False,
"saveID3v1": True, "saveID3v1": True,
"multiArtistSeparator": "default", "multiArtistSeparator": "default",
"singleAlbumArtist": False "singleAlbumArtist": False,
"coverDescriptionUTF8": False
} }
} }

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from mutagen.flac import FLAC, Picture from mutagen.flac import FLAC, Picture
from mutagen.id3 import ID3, ID3NoHeaderError, TXXX, TIT2, TPE1, TALB, TPE2, TRCK, TPOS, TCON, TYER, TDAT, TLEN, TBPM, \ from mutagen.id3 import ID3, ID3NoHeaderError, TXXX, TIT2, TPE1, TALB, TPE2, TRCK, TPOS, TCON, TYER, TDAT, TLEN, TBPM, \
TPUB, TSRC, USLT, SYLT, APIC, IPLS, TCOM, TCOP, TCMP TPUB, TSRC, USLT, SYLT, APIC, IPLS, TCOM, TCOP, TCMP, Encoding
# Adds tags to a MP3 file # Adds tags to a MP3 file
def tagID3(stream, track, save): def tagID3(stream, track, save):
@ -63,7 +63,7 @@ def tagID3(stream, track, save):
if track.lyrics['unsync'] and save['lyrics']: if track.lyrics['unsync'] and save['lyrics']:
tag.add(USLT(text=track.lyrics['unsync'])) tag.add(USLT(text=track.lyrics['unsync']))
if track.lyrics['syncID3'] and save['syncedLyrics']: if track.lyrics['syncID3'] and save['syncedLyrics']:
tag.add(SYLT(3, format=2, type=1, text=track.lyrics['syncID3'])) tag.add(SYLT(Encoding.UTF8, format=2, type=1, text=track.lyrics['syncID3']))
involved_people = [] involved_people = []
for role in track.contributors: for role in track.contributors:
@ -83,7 +83,7 @@ def tagID3(stream, track, save):
if save['cover'] and track.album['picPath']: if save['cover'] and track.album['picPath']:
with open(track.album['picPath'], 'rb') as f: with open(track.album['picPath'], 'rb') as f:
tag.add( tag.add(
APIC(0, 'image/jpeg' if track.album['picPath'].endswith('jpg') else 'image/png', 3, desc='cover', data=f.read())) APIC(Encoding.UTF8 if save['coverDescriptionUTF8'] else Encoding.LATIN1, 'image/jpeg' if track.album['picPath'].endswith('jpg') else 'image/png', 3, desc='cover', data=f.read()))
tag.save(stream, v1=2 if save['saveID3v1'] else 0, v2_version=3, tag.save(stream, v1=2 if save['saveID3v1'] else 0, v2_version=3,
v23_sep=None if save['useNullSeparator'] else '/') v23_sep=None if save['useNullSeparator'] else '/')

View File

@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
setup( setup(
name="deemix", name="deemix",
version="1.3.12", version="1.3.13",
description="A barebone deezer downloader library", description="A barebone deezer downloader library",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",