mirror of
https://gitlab.com/RemixDev/deezer-py.git
synced 2025-01-01 12:26:06 +00:00
Added limit option to gw user favorites
This commit is contained in:
parent
f99f5f3aa2
commit
c3263336a3
|
@ -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.8"
|
__version__ = "0.0.9"
|
||||||
|
|
||||||
class TrackFormats():
|
class TrackFormats():
|
||||||
"""Number associtation for formats"""
|
"""Number associtation for formats"""
|
||||||
|
|
16
deezer/gw.py
16
deezer/gw.py
|
@ -282,8 +282,8 @@ class GW:
|
||||||
body = self.get_track(sng_id)
|
body = self.get_track(sng_id)
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def get_user_playlists(self, user_id):
|
def get_user_playlists(self, user_id, limit=25):
|
||||||
user_profile_page = self.get_user_profile_page(user_id, 'playlists', limit=-1)
|
user_profile_page = self.get_user_profile_page(user_id, 'playlists', limit=limit)
|
||||||
blog_name = user_profile_page['DATA']['USER'].get('BLOG_NAME', "Unkown")
|
blog_name = user_profile_page['DATA']['USER'].get('BLOG_NAME', "Unkown")
|
||||||
data = user_profile_page['TAB']['playlists']['data']
|
data = user_profile_page['TAB']['playlists']['data']
|
||||||
result = []
|
result = []
|
||||||
|
@ -291,22 +291,22 @@ class GW:
|
||||||
result.append(map_user_playlist(playlist, blog_name))
|
result.append(map_user_playlist(playlist, blog_name))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_user_albums(self, user_id):
|
def get_user_albums(self, user_id, limit=25):
|
||||||
data = self.get_user_profile_page(user_id, 'albums', limit=-1)['TAB']['albums']['data']
|
data = self.get_user_profile_page(user_id, 'albums', limit=limit)['TAB']['albums']['data']
|
||||||
result = []
|
result = []
|
||||||
for album in data:
|
for album in data:
|
||||||
result.append(map_user_album(album))
|
result.append(map_user_album(album))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_user_artists(self, user_id):
|
def get_user_artists(self, user_id, limit=25):
|
||||||
data = self.get_user_profile_page(user_id, 'artists', limit=-1)['TAB']['artists']['data']
|
data = self.get_user_profile_page(user_id, 'artists', limit=limit)['TAB']['artists']['data']
|
||||||
result = []
|
result = []
|
||||||
for artist in data:
|
for artist in data:
|
||||||
result.append(map_user_artist(artist))
|
result.append(map_user_artist(artist))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_user_tracks(self, user_id):
|
def get_user_tracks(self, user_id, limit=25):
|
||||||
data = self.get_user_profile_page(user_id, 'loved', limit=-1)['TAB']['loved']['data']
|
data = self.get_user_profile_page(user_id, 'loved', limit=limit)['TAB']['loved']['data']
|
||||||
result = []
|
result = []
|
||||||
for track in data:
|
for track in data:
|
||||||
result.append(map_user_track(track))
|
result.append(map_user_track(track))
|
||||||
|
|
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.8",
|
version="0.0.9",
|
||||||
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