Removed get_track_md5 as it doesn't work anymore

This commit is contained in:
RemixDev 2020-07-02 21:57:02 +02:00
parent e51576ab2f
commit 309ac9bd13
4 changed files with 2 additions and 38 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
__version__ = "1.1.3" __version__ = "1.1.4"

View File

@ -36,27 +36,6 @@ class Deezer:
token_data = self.gw_api_call('deezer.getUserData') token_data = self.gw_api_call('deezer.getUserData')
return token_data["results"]["checkForm"] 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): def gw_api_call(self, method, args=None):
if args is None: if args is None:
args = {} args = {}

View File

@ -171,9 +171,6 @@ def parseEssentialTrackData(track, trackAPI):
def getTrackData(dz, trackAPI_gw, settings, trackAPI=None, albumAPI_gw=None, albumAPI=None): 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 = {}
track['title'] = trackAPI_gw['SNG_TITLE'].strip() 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']: 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: if track['fallbackId'] != 0:
logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not yet encoded, using fallback id") logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not yet encoded, using fallback id")
trackNew = dz.get_track_gw(track['fallbackId']) 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) track = parseEssentialTrackData(track, trackNew)
return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, interface=interface) return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, interface=interface)
elif not 'searched' in track and settings['fallbackSearch']: elif not 'searched' in track and settings['fallbackSearch']:
@ -503,8 +498,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
track['album']['title']) track['album']['title'])
if searchedId != 0: if searchedId != 0:
trackNew = dz.get_track_gw(searchedId) 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 = parseEssentialTrackData(track, trackNew)
track['searched'] = True track['searched'] = True
return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, 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: if track['fallbackId'] != 0:
logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not found at desired bitrate, using fallback id") logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not found at desired bitrate, using fallback id")
trackNew = dz.get_track_gw(track['fallbackId']) 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) track = parseEssentialTrackData(track, trackNew)
return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, interface=interface) return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, interface=interface)
elif not 'searched' in track and settings['fallbackSearch']: elif not 'searched' in track and settings['fallbackSearch']:
@ -560,8 +551,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
track['album']['title']) track['album']['title'])
if searchedId != 0: if searchedId != 0:
trackNew = dz.get_track_gw(searchedId) 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 = parseEssentialTrackData(track, trackNew)
track['searched'] = True track['searched'] = True
return downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=track, 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: if track['fallbackId'] != 0:
logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not available, using fallback id") logger.warn(f"[{track['mainArtist']['name']} - {track['title']}] Track not available, using fallback id")
trackNew = dz.get_track_gw(track['fallbackId']) 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) track = parseEssentialTrackData(track, trackNew)
return 2 return 2
elif not 'searched' in track and settings['fallbackSearch']: elif not 'searched' in track and settings['fallbackSearch']:
@ -798,8 +785,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
track['album']['title']) track['album']['title'])
if searchedId != 0: if searchedId != 0:
trackNew = dz.get_track_gw(searchedId) 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 = parseEssentialTrackData(track, trackNew)
track['searched'] = True track['searched'] = True
return 2 return 2

View File

@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
setup( setup(
name="deemix", name="deemix",
version="1.1.3", version="1.1.4",
description="A barebone deezer downloader library", description="A barebone deezer downloader library",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",