Fixed bitrate fallback check

This commit is contained in:
RemixDev 2021-06-13 14:06:17 +02:00
parent f8b835229c
commit c42eff7f95
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
2 changed files with 3 additions and 2 deletions

View File

@ -105,8 +105,9 @@ def getPreferredBitrate(track, bitrate, shouldFallback, uuid=None, listener=None
)
try:
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
if track.filesizes[f"FILESIZE_{formatName}"] == 0: return None
return formatNumber
except requests.exceptions.HTTPError: # if the format is not available, Deezer returns a 403 error
return None

View File

@ -92,7 +92,7 @@ class Track:
filesizes = {}
for key, value in response.items():
if key.startswith("FILESIZE_"):
filesizes[key] = value
filesizes[key] = int(value)
filesizes[key+"_TESTED"] = False
self.filesizes = filesizes