Made rating an optional tag

This commit is contained in:
RemixDev 2021-08-04 20:39:51 +02:00
parent 09f087484d
commit 2d3d6d0699
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
2 changed files with 14 additions and 11 deletions

View File

@ -89,6 +89,7 @@ DEFAULTS = {
"composer": False,
"involvedPeople": False,
"source": False,
"rating": False,
"savePlaylistAsCompilation": False,
"useNullSeparator": False,
"saveID3v1": True,

View File

@ -12,14 +12,6 @@ def tagID3(path, track, save):
except ID3NoHeaderError:
tag = ID3()
rank = round((int(track.rank) / 10000) * 2.55)
if rank > 255 :
rank = 255
else:
rank = round(rank, 0)
tag.add(POPM(rating=rank))
if save['title']:
tag.add(TIT2(text=track.title))
@ -106,6 +98,15 @@ def tagID3(path, track, save):
tag.add(TXXX(desc="SOURCE", text='Deezer'))
tag.add(TXXX(desc="SOURCEID", text=str(track.id)))
if save['rating']:
rank = round((int(track.rank) / 10000) * 2.55)
if rank > 255 :
rank = 255
else:
rank = round(rank, 0)
tag.add(POPM(rating=rank))
if save['cover'] and track.album.embeddedCoverPath:
descEncoding = Encoding.LATIN1
@ -131,9 +132,6 @@ def tagFLAC(path, track, save):
tag.delete()
tag.clear_pictures()
rank = round((int(track.rank) / 10000))
tag['RATING'] = str(rank)
if save['title']:
tag["TITLE"] = track.title
@ -210,6 +208,10 @@ def tagFLAC(path, track, save):
tag["SOURCE"] = 'Deezer'
tag["SOURCEID"] = str(track.id)
if save['rating']:
rank = round((int(track.rank) / 10000))
tag['RATING'] = str(rank)
if save['cover'] and track.album.embeddedCoverPath:
image = Picture()
image.type = PictureType.COVER_FRONT