From 4567391a4a9c1c3271843e6291901ddc062b3044 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 15 Oct 2020 00:33:16 +0200 Subject: [PATCH] Fixed issues with songs without lyrics Updated PyPi to 1.5.16 --- deemix/__init__.py | 2 +- deemix/api/deezer.py | 13 +++++++++---- setup.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deemix/__init__.py b/deemix/__init__.py index 334f8fc..15f3e74 100644 --- a/deemix/__init__.py +++ b/deemix/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python3 -__version__ = "1.5.15" +__version__ = "1.5.16" diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 0aed561..9c8731f 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -271,13 +271,18 @@ class Deezer: return self.gw_api_call('deezer.getChildAccounts')['results'] def get_track_gw(self, sng_id): - if int(sng_id) < 0: - body = self.gw_api_call('song.getData', {'sng_id': sng_id}) - else: - body = self.gw_api_call('deezer.pageTrack', {'sng_id': sng_id}) + body = None + if int(sng_id) > 0: + try: + body = self.gw_api_call('deezer.pageTrack', {'sng_id': sng_id}) + except: + body = None + if body: if 'LYRICS' in body['results']: body['results']['DATA']['LYRICS'] = body['results']['LYRICS'] body['results'] = body['results']['DATA'] + else: + body = self.gw_api_call('song.getData', {'sng_id': sng_id}) return body['results'] def get_tracks_gw(self, ids): diff --git a/setup.py b/setup.py index 5227393..dc3d3be 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text() setup( name="deemix", - version="1.5.15", + version="1.5.16", description="A barebone deezer downloader library", long_description=README, long_description_content_type="text/markdown",