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
__version__ = "1.3.12"
__version__ = "1.3.13"

View file

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

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
from mutagen.flac import FLAC, Picture
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
def tagID3(stream, track, save):
@ -63,7 +63,7 @@ def tagID3(stream, track, save):
if track.lyrics['unsync'] and save['lyrics']:
tag.add(USLT(text=track.lyrics['unsync']))
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 = []
for role in track.contributors:
@ -83,7 +83,7 @@ def tagID3(stream, track, save):
if save['cover'] and track.album['picPath']:
with open(track.album['picPath'], 'rb') as f:
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,
v23_sep=None if save['useNullSeparator'] else '/')

View file

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