mirror of
https://gitlab.com/RemixDev/deezer-py.git
synced 2025-01-17 03:55:13 +00:00
Implemented get_track_with_fallback; Fixed charts
This commit is contained in:
parent
5a03419c53
commit
1856846992
|
@ -4,7 +4,7 @@ from deezer.gw import GW
|
||||||
from deezer.api import API
|
from deezer.api import API
|
||||||
import json
|
import json
|
||||||
|
|
||||||
__version__ = "0.0.2"
|
__version__ = "0.0.3"
|
||||||
|
|
||||||
class TrackFormats():
|
class TrackFormats():
|
||||||
"""Number associtation for formats"""
|
"""Number associtation for formats"""
|
||||||
|
|
|
@ -265,7 +265,7 @@ class API:
|
||||||
# Extra calls
|
# Extra calls
|
||||||
|
|
||||||
def get_countries_charts(self):
|
def get_countries_charts(self):
|
||||||
temp = self.get_user_playlists('637006841')
|
temp = self.get_user_playlists('637006841', limit=-1)['data']
|
||||||
result = sorted(temp, key=lambda k: k['title']) # Sort all playlists
|
result = sorted(temp, key=lambda k: k['title']) # Sort all playlists
|
||||||
if not result[0]['title'].startswith('Top'): result = result[1:] # Remove loved tracks playlist
|
if not result[0]['title'].startswith('Top'): result = result[1:] # Remove loved tracks playlist
|
||||||
return result
|
return result
|
||||||
|
|
15
deezer/gw.py
15
deezer/gw.py
|
@ -253,6 +253,21 @@ class GW:
|
||||||
result['all'].append(obj)
|
result['all'].append(obj)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def get_track_with_fallback(self, sng_id):
|
||||||
|
body = None
|
||||||
|
if int(sng_id) > 0:
|
||||||
|
try:
|
||||||
|
body = self.get_track_page(sng_id)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if body:
|
||||||
|
if 'LYRICS' in body:
|
||||||
|
body['DATA']['LYRICS'] = body['LYRICS']
|
||||||
|
body = body['DATA']
|
||||||
|
else:
|
||||||
|
body = self.get_track(sng_id)
|
||||||
|
return body
|
||||||
|
|
||||||
class APIError(Exception):
|
class APIError(Exception):
|
||||||
"""Base class for Deezer exceptions"""
|
"""Base class for Deezer exceptions"""
|
||||||
pass
|
pass
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="deezer-py",
|
name="deezer-py",
|
||||||
version="0.0.2",
|
version="0.0.3",
|
||||||
description="A wrapper for all Deezer's APIs",
|
description="A wrapper for all Deezer's APIs",
|
||||||
long_description=README,
|
long_description=README,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|
Loading…
Reference in a new issue