From eb84a392ba5f7949a66ff36671f31472a2412d1e Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 23 Dec 2021 19:25:45 +0100 Subject: [PATCH] fixed issues from version parity --- deemix/downloader.py | 6 +++++- deemix/types/Album.py | 2 +- deemix/types/Track.py | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deemix/downloader.py b/deemix/downloader.py index 5286c48..49fc616 100644 --- a/deemix/downloader.py +++ b/deemix/downloader.py @@ -112,7 +112,11 @@ def getPreferredBitrate(dz, track, preferredBitrate, shouldFallback, feelingLuck nonlocal wrongLicense, isGeolocked url = None # Check the track with the legit method - if formatName.lower() in track.filesizes and track.filesizes[formatName.lower()] != "0": + wrongLicense = ( + (formatName == "FLAC" or formatName.startswidth("MP4_RA")) and not dz.current_user.get('can_stream_lossless') or \ + formatName == "MP3_320" and not dz.current_user.get('can_stream_hq') + ) + if track.filesizes.get(formatName.lower()) and track.filesizes[formatName.lower()] != "0": try: url = dz.get_track_url(track.trackToken, formatName) except (WrongLicense, WrongGeolocation) as e: diff --git a/deemix/types/Album.py b/deemix/types/Album.py index 3edf40f..6238768 100644 --- a/deemix/types/Album.py +++ b/deemix/types/Album.py @@ -91,7 +91,7 @@ class Album: self.date.year = release_date[0:4] self.date.fixDayMonth() - self.discTotal = albumAPI.get('nb_disk') + self.discTotal = albumAPI.get('nb_disk', "1") self.copyright = albumAPI.get('copyright') if self.pic.md5 == "": diff --git a/deemix/types/Track.py b/deemix/types/Track.py index 40bf065..e545281 100644 --- a/deemix/types/Track.py +++ b/deemix/types/Track.py @@ -63,6 +63,7 @@ class Track: self.trackTokenExpiration = trackAPI['track_token_expire'] self.MD5 = trackAPI.get('md5_origin') self.mediaVersion = trackAPI['media_version'] + self.filesizes = trackAPI['filesizes'] self.fallbackID = "0" if 'fallback_id' in trackAPI: self.fallbackID = trackAPI['fallback_id']