Continued work on the UI

This commit is contained in:
RemixDev 2020-04-08 18:43:35 +02:00
parent 3f55cd1a15
commit 1db90b31e6
2 changed files with 16 additions and 4 deletions

View File

@ -202,6 +202,15 @@ class Deezer:
tracks_array.append(track) tracks_array.append(track)
return tracks_array return tracks_array
def search_gw(self, term):
results = self.gw_api_call('deezer.pageSearch', {"query": term, "start": 0, "nb": 40, "suggest": True, "artist_suggest": True, "top_tracks": True})['results']
order = []
for x in results['ORDER']:
if x in ['TOP_RESULT', 'TRACK', 'ALBUM', 'ARTIST', 'PLAYLIST']:
order.append(x)
results['ORDER'] = order
return results
def get_lyrics_gw(self, sng_id): def get_lyrics_gw(self, sng_id):
return self.gw_api_call('song.getLyrics', {'sng_id': sng_id})["results"] return self.gw_api_call('song.getLyrics', {'sng_id': sng_id})["results"]

View File

@ -37,13 +37,16 @@ def initialize():
login() login()
return True return True
def search(term): def search(term, type):
result = dz.search(term, type)
print(result)
return result
def mainSearch(term):
if isValidLink(term): if isValidLink(term):
downloadLink(term) downloadLink(term)
return {"message": "Downloaded!"} return {"message": "Downloaded!"}
result = dz.search(term, "track") return dz.search_gw(term)
print(result)
return result
def downloadLink(url, bitrate=None): def downloadLink(url, bitrate=None):
global settings global settings