|
a/src/cdplugins/qobuz/session.py |
|
b/src/cdplugins/qobuz/session.py |
|
... |
|
... |
88 |
if 'playlists' in data:
|
88 |
if 'playlists' in data:
|
89 |
return [_parse_playlist(pl) for pl in \
|
89 |
return [_parse_playlist(pl) for pl in \
|
90 |
data['playlists']['items']]
|
90 |
data['playlists']['items']]
|
91 |
return []
|
91 |
return []
|
92 |
|
92 |
|
93 |
def search(self, query):
|
93 |
def search(self, query, tp):
|
94 |
data = self.api.catalog_search(query=query)
|
94 |
data = self.api.catalog_search(query=query, type=tp)
|
|
|
95 |
try:
|
95 |
ar = [_parse_artist(i) for i in data['artists']['items']]
|
96 |
ar = [_parse_artist(i) for i in data['artists']['items']]
|
|
|
97 |
except:
|
|
|
98 |
ar = []
|
|
|
99 |
try:
|
96 |
al = [_parse_album(i) for i in data['albums']['items']]
|
100 |
al = [_parse_album(i) for i in data['albums']['items']]
|
|
|
101 |
except:
|
|
|
102 |
al = []
|
|
|
103 |
try:
|
97 |
pl = [_parse_playlist(i) for i in data['playlists']['items']]
|
104 |
pl = [_parse_playlist(i) for i in data['playlists']['items']]
|
|
|
105 |
except:
|
|
|
106 |
pl = []
|
|
|
107 |
try:
|
98 |
tr = [_parse_track(i) for i in data['tracks']['items']]
|
108 |
tr = [_parse_track(i) for i in data['tracks']['items']]
|
|
|
109 |
except:
|
|
|
110 |
tr = []
|
99 |
return SearchResult(artists=ar, albums=al, playlists=pl, tracks=tr)
|
111 |
return SearchResult(artists=ar, albums=al, playlists=pl, tracks=tr)
|
100 |
|
112 |
|
101 |
|
113 |
|
102 |
def _parse_artist(json_obj):
|
114 |
def _parse_artist(json_obj):
|
103 |
artist = Artist(id=json_obj['id'], name=json_obj['name'])
|
115 |
artist = Artist(id=json_obj['id'], name=json_obj['name'])
|