|
a/src/mediaserver/cdplugins/qobuz/session.py |
|
b/src/mediaserver/cdplugins/qobuz/session.py |
|
... |
|
... |
56 |
data = self.api.artist_getSimilarArtists(artist_id=artid)
|
56 |
data = self.api.artist_getSimilarArtists(artist_id=artid)
|
57 |
if 'artists' in data and 'items' in data['artists']:
|
57 |
if 'artists' in data and 'items' in data['artists']:
|
58 |
return [_parse_artist(art) for art in data['artists']['items']]
|
58 |
return [_parse_artist(art) for art in data['artists']['items']]
|
59 |
return []
|
59 |
return []
|
60 |
|
60 |
|
61 |
def get_featured_albums(self, genre_id=None, type='new-releases'):
|
61 |
def get_featured_albums(self, genre_id='None', type='new-releases'):
|
62 |
#uplog("get_featured_albums, genre_id %s type %s " % (genre_id, type))
|
62 |
#uplog("get_featured_albums, genre_id %s type %s " % (genre_id, type))
|
|
|
63 |
if genre_id != 'None':
|
63 |
data = self.api.album_getFeatured(type=type,
|
64 |
data = self.api.album_getFeatured(type=type,
|
64 |
genre_id=genre_id, limit=100)
|
65 |
genre_id=genre_id, limit=100)
|
|
|
66 |
else:
|
|
|
67 |
data = self.api.album_getFeatured(type=type, limit=100)
|
|
|
68 |
|
65 |
try:
|
69 |
try:
|
66 |
albums = [_parse_album(alb) for alb in data['albums']['items']]
|
70 |
albums = [_parse_album(alb) for alb in data['albums']['items']]
|
67 |
if albums:
|
71 |
if albums:
|
68 |
return [alb for alb in albums if alb.available]
|
72 |
return [alb for alb in albums if alb.available]
|
69 |
except:
|
73 |
except:
|
70 |
pass
|
74 |
pass
|
71 |
return []
|
75 |
return []
|
72 |
|
76 |
|
73 |
def get_featured_playlists(self, genre_id=None):
|
77 |
def get_featured_playlists(self, genre_id='None'):
|
|
|
78 |
if genre_id != 'None':
|
74 |
data = self.api.playlist_getFeatured(type='editor-picks',
|
79 |
data = self.api.playlist_getFeatured(type='editor-picks',
|
75 |
genre_id=genre_id, limit=100)
|
80 |
genre_id=genre_id, limit=100)
|
|
|
81 |
else:
|
|
|
82 |
data = self.api.playlist_getFeatured(type='editor-picks',
|
|
|
83 |
limit=100)
|
76 |
if data and 'playlists' in data:
|
84 |
if data and 'playlists' in data:
|
77 |
return [_parse_playlist(pl) for pl in data['playlists']['items']]
|
85 |
return [_parse_playlist(pl) for pl in data['playlists']['items']]
|
78 |
return []
|
86 |
return []
|
79 |
|
87 |
|
80 |
# content_type: albums/artists/playlists. type : The type of
|
88 |
# content_type: albums/artists/playlists. type : The type of
|
|
... |
|
... |
82 |
# new-releases, press-awards, editor-picks, most-featured
|
90 |
# new-releases, press-awards, editor-picks, most-featured
|
83 |
# In practise, and despite the existence of the
|
91 |
# In practise, and despite the existence of the
|
84 |
# catalog_getFeaturedTypes call which returns the above list, I
|
92 |
# catalog_getFeaturedTypes call which returns the above list, I
|
85 |
# could not find a way to pass the type parameter to
|
93 |
# could not find a way to pass the type parameter to
|
86 |
# catalog_getFeatured (setting type triggers an
|
94 |
# catalog_getFeatured (setting type triggers an
|
87 |
# error). album_getFeatured() accepts type, but it's not clear
|
95 |
# error). album_getFeatured() and playlist_getFeatured() do accept type.
|
88 |
# what it does.
|
|
|
89 |
def get_featured_items(self, content_type, type=''):
|
96 |
def get_featured_items(self, content_type, type=''):
|
90 |
#uplog("FEATURED TYPES: %s" % self.api.catalog_getFeaturedTypes())
|
97 |
#uplog("FEATURED TYPES: %s" % self.api.catalog_getFeaturedTypes())
|
91 |
limit = '100'
|
98 |
limit = '40'
|
92 |
data = self.api.catalog_getFeatured(limit=limit)
|
99 |
data = self.api.catalog_getFeatured(limit=limit)
|
93 |
#uplog("Featured: %s" % json.dumps(data,indent=4)))
|
100 |
#uplog("Featured: %s" % json.dumps(data,indent=4)))
|
94 |
if content_type == 'artists':
|
101 |
if content_type == 'artists':
|
95 |
if 'artists' in data:
|
102 |
if 'artists' in data:
|
96 |
return [_parse_artist(i) for i in data['artists']['items']]
|
103 |
return [_parse_artist(i) for i in data['artists']['items']]
|
|
... |
|
... |
102 |
return [_parse_album(alb) for alb in data['albums']['items']]
|
109 |
return [_parse_album(alb) for alb in data['albums']['items']]
|
103 |
return []
|
110 |
return []
|
104 |
|
111 |
|
105 |
def get_genres(self, parent=None):
|
112 |
def get_genres(self, parent=None):
|
106 |
data = self.api.genre_list(parent_id=parent)
|
113 |
data = self.api.genre_list(parent_id=parent)
|
|
|
114 |
return [Genre(id=None, name='All Genres')] + \
|
107 |
return [_parse_genre(g) for g in data['genres']['items']]
|
115 |
[_parse_genre(g) for g in data['genres']['items']]
|
108 |
|
116 |
|
109 |
def _search1(self, query, tp):
|
117 |
def _search1(self, query, tp):
|
110 |
limit = 200
|
118 |
limit = 200
|
111 |
slice = 100
|
119 |
slice = 100
|
112 |
if tp == 'artists':
|
120 |
if tp == 'artists':
|