Fixed download cancelling issue and made track formats number clearer

This commit is contained in:
RemixDev
2020-10-02 19:20:23 +02:00
parent 431a558467
commit f2caa297f5
4 changed files with 63 additions and 48 deletions

View File

@ -1,5 +1,6 @@
import re
import string
from deemix.api.deezer import TrackFormats
def generateReplayGainString(trackGain):
return "{0:.2f} dB".format((float(trackGain) + 18.4) * -1)
@ -7,17 +8,17 @@ def generateReplayGainString(trackGain):
def getBitrateInt(txt):
txt = str(txt).lower()
if txt in ['flac', 'lossless', '9']:
return 9
return TrackFormats.FLAC
elif txt in ['mp3', '320', '3']:
return 3
return TrackFormats.MP3_320
elif txt in ['128', '1']:
return 1
return TrackFormats.MP3_128
elif txt in ['360', '360_hq', '15']:
return 15
return TrackFormats.MP4_RA3
elif txt in ['360_mq', '14']:
return 14
return TrackFormats.MP4_RA2
elif txt in ['360_lq', '13']:
return 13
return TrackFormats.MP4_RA1
else:
return None

View File

@ -2,16 +2,17 @@ import re
from os.path import sep as pathSep
from pathlib import Path
from unicodedata import normalize
from deemix.api.deezer import TrackFormats
bitrateLabels = {
15: "360 HQ",
14: "360 MQ",
13: "360 LQ",
9: "FLAC",
3: "320",
1: "128",
8: "128",
0: "MP3"
TrackFormats.MP4_RA3: "360 HQ",
TrackFormats.MP4_RA2: "360 MQ",
TrackFormats.MP4_RA1: "360 LQ",
TrackFormats.FLAC : "FLAC",
TrackFormats.MP3_320: "320",
TrackFormats.MP3_128: "128",
TrackFormats.DEFAULT: "128",
TrackFormats.LOCAL : "MP3"
}
def fixName(txt, char='_'):