From 309ac9bd1305f9c177197c38d1603302c1c58677 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 2 Jul 2020 21:57:02 +0200 Subject: [PATCH] Removed get_track_md5 as it doesn't work anymore --- deemix/__init__.py | 2 +- deemix/api/deezer.py | 21 --------------------- deemix/app/downloader.py | 15 --------------- setup.py | 2 +- 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/deemix/__init__.py b/deemix/__init__.py index 69b5af1..ba31481 100644 --- a/deemix/__init__.py +++ b/deemix/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python3 -__version__ = "1.1.3" +__version__ = "1.1.4" diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 1f882c0..d0ded8f 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -36,27 +36,6 @@ class Deezer: token_data = self.gw_api_call('deezer.getUserData') return token_data["results"]["checkForm"] - def get_track_md5(self, sng_id): - try: - site = self.session.post( - "https://api.deezer.com/1.0/gateway.php", - params={ - 'api_key': "4VCYIJUCDLOUELGD1V8WBVYBNVDYOXEWSLLZDONGBBDFVXTZJRXPR29JRLQFO6ZE", - 'sid': self.sid, - 'input': '3', - 'output': '3', - 'method': 'song_getData' - }, - timeout=30, - json={'sng_id': sng_id}, - headers=self.http_headers - ) - except: - time.sleep(2) - return self.get_track_md5(sng_id) - response = site.json() - return response['results']['PUID'] - def gw_api_call(self, method, args=None): if args is None: args = {} diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index 21e7cf8..8aa4062 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -171,9 +171,6 @@ def parseEssentialTrackData(track, trackAPI): def getTrackData(dz, trackAPI_gw, settings, trackAPI=None, albumAPI_gw=None, albumAPI=None): - if not 'MD5_ORIGIN' in trackAPI_gw: - trackAPI_gw['MD5_ORIGIN'] = dz.get_track_md5(trackAPI_gw['SNG_ID']) - track = {} track['title'] = trackAPI_gw['SNG_TITLE'].strip() if 'VERSION' in trackAPI_gw and trackAPI_gw['VERSION'] and not trackAPI_gw['VERSION'] in trackAPI_gw['SNG_TITLE']: @@ -493,8 +490,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None if track['fallbackId'] != 0: logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not yet encoded, using fallback id") trackNew = dz.get_track_gw(track['fallbackId']) - if not 'MD5_ORIGIN' in trackNew: - trackNew['MD5_ORIGIN'] = dz.get_track_md5(trackNew['SNG_ID']) track = parseEssentialTrackData(track, trackNew) return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, interface=interface) elif not 'searched' in track and settings['fallbackSearch']: @@ -503,8 +498,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None track['album']['title']) if searchedId != 0: trackNew = dz.get_track_gw(searchedId) - if not 'MD5_ORIGIN' in trackNew: - trackNew['MD5_ORIGIN'] = dz.get_track_md5(trackNew['SNG_ID']) track = parseEssentialTrackData(track, trackNew) track['searched'] = True return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, @@ -550,8 +543,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None if track['fallbackId'] != 0: logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not found at desired bitrate, using fallback id") trackNew = dz.get_track_gw(track['fallbackId']) - if not 'MD5_ORIGIN' in trackNew: - trackNew['MD5_ORIGIN'] = dz.get_track_md5(trackNew['SNG_ID']) track = parseEssentialTrackData(track, trackNew) return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, interface=interface) elif not 'searched' in track and settings['fallbackSearch']: @@ -560,8 +551,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None track['album']['title']) if searchedId != 0: trackNew = dz.get_track_gw(searchedId) - if not 'MD5_ORIGIN' in trackNew: - trackNew['MD5_ORIGIN'] = dz.get_track_md5(trackNew['SNG_ID']) track = parseEssentialTrackData(track, trackNew) track['searched'] = True return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, @@ -788,8 +777,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None if track['fallbackId'] != 0: logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not available, using fallback id") trackNew = dz.get_track_gw(track['fallbackId']) - if not 'MD5_ORIGIN' in trackNew: - trackNew['MD5_ORIGIN'] = dz.get_track_md5(trackNew['SNG_ID']) track = parseEssentialTrackData(track, trackNew) return 2 elif not 'searched' in track and settings['fallbackSearch']: @@ -798,8 +785,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None track['album']['title']) if searchedId != 0: trackNew = dz.get_track_gw(searchedId) - if not 'MD5_ORIGIN' in trackNew: - trackNew['MD5_ORIGIN'] = dz.get_track_md5(trackNew['SNG_ID']) track = parseEssentialTrackData(track, trackNew) track['searched'] = True return 2 diff --git a/setup.py b/setup.py index eda8544..a3efe7a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text() setup( name="deemix", - version="1.1.3", + version="1.1.4", description="A barebone deezer downloader library", long_description=README, long_description_content_type="text/markdown",