mirror of
https://gitlab.com/RemixDev/deemix-py.git
synced 2024-12-29 11:06:14 +00:00
Made rating an optional tag
This commit is contained in:
parent
09f087484d
commit
2d3d6d0699
|
@ -89,6 +89,7 @@ DEFAULTS = {
|
||||||
"composer": False,
|
"composer": False,
|
||||||
"involvedPeople": False,
|
"involvedPeople": False,
|
||||||
"source": False,
|
"source": False,
|
||||||
|
"rating": False,
|
||||||
"savePlaylistAsCompilation": False,
|
"savePlaylistAsCompilation": False,
|
||||||
"useNullSeparator": False,
|
"useNullSeparator": False,
|
||||||
"saveID3v1": True,
|
"saveID3v1": True,
|
||||||
|
|
|
@ -12,14 +12,6 @@ def tagID3(path, track, save):
|
||||||
except ID3NoHeaderError:
|
except ID3NoHeaderError:
|
||||||
tag = ID3()
|
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']:
|
if save['title']:
|
||||||
tag.add(TIT2(text=track.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="SOURCE", text='Deezer'))
|
||||||
tag.add(TXXX(desc="SOURCEID", text=str(track.id)))
|
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:
|
if save['cover'] and track.album.embeddedCoverPath:
|
||||||
|
|
||||||
descEncoding = Encoding.LATIN1
|
descEncoding = Encoding.LATIN1
|
||||||
|
@ -131,9 +132,6 @@ def tagFLAC(path, track, save):
|
||||||
tag.delete()
|
tag.delete()
|
||||||
tag.clear_pictures()
|
tag.clear_pictures()
|
||||||
|
|
||||||
rank = round((int(track.rank) / 10000))
|
|
||||||
tag['RATING'] = str(rank)
|
|
||||||
|
|
||||||
if save['title']:
|
if save['title']:
|
||||||
tag["TITLE"] = track.title
|
tag["TITLE"] = track.title
|
||||||
|
|
||||||
|
@ -210,6 +208,10 @@ def tagFLAC(path, track, save):
|
||||||
tag["SOURCE"] = 'Deezer'
|
tag["SOURCE"] = 'Deezer'
|
||||||
tag["SOURCEID"] = str(track.id)
|
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:
|
if save['cover'] and track.album.embeddedCoverPath:
|
||||||
image = Picture()
|
image = Picture()
|
||||||
image.type = PictureType.COVER_FRONT
|
image.type = PictureType.COVER_FRONT
|
||||||
|
|
Loading…
Reference in a new issue