Fixed bitrate fallback check
This commit is contained in:
parent
f8b835229c
commit
c42eff7f95
|
@ -105,8 +105,9 @@ def getPreferredBitrate(track, bitrate, shouldFallback, uuid=None, listener=None
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
request.raise_for_status()
|
request.raise_for_status()
|
||||||
track.filesizes[f"FILESIZE_{formatName}"] = request.headers["Content-Length"]
|
track.filesizes[f"FILESIZE_{formatName}"] = int(request.headers["Content-Length"])
|
||||||
track.filesizes[f"FILESIZE_{formatName}_TESTED"] = True
|
track.filesizes[f"FILESIZE_{formatName}_TESTED"] = True
|
||||||
|
if track.filesizes[f"FILESIZE_{formatName}"] == 0: return None
|
||||||
return formatNumber
|
return formatNumber
|
||||||
except requests.exceptions.HTTPError: # if the format is not available, Deezer returns a 403 error
|
except requests.exceptions.HTTPError: # if the format is not available, Deezer returns a 403 error
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Track:
|
||||||
filesizes = {}
|
filesizes = {}
|
||||||
for key, value in response.items():
|
for key, value in response.items():
|
||||||
if key.startswith("FILESIZE_"):
|
if key.startswith("FILESIZE_"):
|
||||||
filesizes[key] = value
|
filesizes[key] = int(value)
|
||||||
filesizes[key+"_TESTED"] = False
|
filesizes[key+"_TESTED"] = False
|
||||||
self.filesizes = filesizes
|
self.filesizes = filesizes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue