mirror of
https://gitlab.com/RemixDev/deezer-py.git
synced 2025-01-01 12:26:06 +00:00
Fixed private playlist username
This commit is contained in:
parent
2ac9bf0d0d
commit
f99f5f3aa2
|
@ -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.7"
|
__version__ = "0.0.8"
|
||||||
|
|
||||||
class TrackFormats():
|
class TrackFormats():
|
||||||
"""Number associtation for formats"""
|
"""Number associtation for formats"""
|
||||||
|
|
|
@ -283,10 +283,12 @@ class GW:
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def get_user_playlists(self, user_id):
|
def get_user_playlists(self, user_id):
|
||||||
data = self.get_user_profile_page(user_id, 'playlists', limit=-1)['TAB']['playlists']['data']
|
user_profile_page = self.get_user_profile_page(user_id, 'playlists', limit=-1)
|
||||||
|
blog_name = user_profile_page['DATA']['USER'].get('BLOG_NAME', "Unkown")
|
||||||
|
data = user_profile_page['TAB']['playlists']['data']
|
||||||
result = []
|
result = []
|
||||||
for playlist in data:
|
for playlist in data:
|
||||||
result.append(map_user_playlist(playlist))
|
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):
|
||||||
|
|
|
@ -78,7 +78,7 @@ def map_user_album(album):
|
||||||
}
|
}
|
||||||
|
|
||||||
# maps gw-light api user/playlists to standard api
|
# maps gw-light api user/playlists to standard api
|
||||||
def map_user_playlist(playlist):
|
def map_user_playlist(playlist, default_user_name=""):
|
||||||
return {
|
return {
|
||||||
'id': playlist['PLAYLIST_ID'],
|
'id': playlist['PLAYLIST_ID'],
|
||||||
'title': playlist['TITLE'],
|
'title': playlist['TITLE'],
|
||||||
|
@ -92,7 +92,7 @@ def map_user_playlist(playlist):
|
||||||
'tracklist': 'https://api.deezer.com/playlist/'+str(playlist['PLAYLIST_ID'])+'/tracks',
|
'tracklist': 'https://api.deezer.com/playlist/'+str(playlist['PLAYLIST_ID'])+'/tracks',
|
||||||
'creator': {
|
'creator': {
|
||||||
'id': playlist['PARENT_USER_ID'],
|
'id': playlist['PARENT_USER_ID'],
|
||||||
'name': playlist['PARENT_USERNAME'] if 'PARENT_USERNAME' in playlist else self.user['name']
|
'name': playlist.get('PARENT_USERNAME', default_user_name)
|
||||||
},
|
},
|
||||||
'type': 'playlist'
|
'type': 'playlist'
|
||||||
}
|
}
|
||||||
|
|
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.7",
|
version="0.0.8",
|
||||||
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