Implemented Favorites tab
This commit is contained in:
parent
15007e9c28
commit
c4d0ae6f68
16
README.md
16
README.md
|
@ -10,13 +10,20 @@ Currently there are no available builds as it's still in development.<br>
|
||||||
But you can try to run it yourself!<br>
|
But you can try to run it yourself!<br>
|
||||||
|
|
||||||
## Running instructions
|
## Running instructions
|
||||||
NOTE: Python 3 is required for this app.<br>
|
### Standard way
|
||||||
|
NOTE: Python 3 is required for this app. Make sure you tick the option to add python to PATH when installing.<br>
|
||||||
|
NOTE: If `pip3` and `python3` are "not recognized commands" try using `pip` and `python` instead<br>
|
||||||
<br>
|
<br>
|
||||||
After installing python install the dependencies using `pip install -r requirements.txt`<br>
|
After installing python install the dependencies using `pip3 install -r requirements.txt`<br>
|
||||||
Run `python -m deemix --help` to see how to use the app<br>
|
Run `python3 -m deemix --help` to see how to use the app<br>
|
||||||
Run `python server.py` to start the server and then connect to 127.0.0.1:33333.<br>
|
Run `python3 server.py` to start the server and then connect to 127.0.0.1:33333.<br>
|
||||||
Enjoy!<br>
|
Enjoy!<br>
|
||||||
|
|
||||||
|
### Easy Windows way
|
||||||
|
Download `install.bat` file to your PC and place it in the folder where you want Deemix to live<br>
|
||||||
|
Start the `install.bat` as administrator<br>
|
||||||
|
Wait for it to finish, then run the `start.bat`<br>
|
||||||
|
|
||||||
## What's left to do?
|
## What's left to do?
|
||||||
Library:
|
Library:
|
||||||
- Add a log system
|
- Add a log system
|
||||||
|
@ -26,7 +33,6 @@ Library:
|
||||||
WebUI:
|
WebUI:
|
||||||
- Stylize and separate the options in the Settings tab
|
- Stylize and separate the options in the Settings tab
|
||||||
- Home tab
|
- Home tab
|
||||||
- Favorites / Playlists tab
|
|
||||||
- About Section
|
- About Section
|
||||||
- Animations and style polishing
|
- Animations and style polishing
|
||||||
- ?
|
- ?
|
||||||
|
|
|
@ -253,17 +253,137 @@ class Deezer:
|
||||||
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"]
|
||||||
|
|
||||||
def get_user_playlist(self, user_id):
|
def get_user_playlists_gw(self, user_id):
|
||||||
|
data = self.gw_api_call('deezer.pageProfile', {'user_id': user_id, 'tab': 'playlists', 'nb': -1})['results']['TAB']['playlists']['data']
|
||||||
|
result = []
|
||||||
|
for playlist in data:
|
||||||
|
item = {
|
||||||
|
'id': playlist['PLAYLIST_ID'],
|
||||||
|
'title': playlist['TITLE'],
|
||||||
|
'nb_tracks': playlist['NB_SONG'],
|
||||||
|
'link': 'https://www.deezer.com/playlist/'+playlist['PLAYLIST_ID'],
|
||||||
|
'picture': 'https://api.deezer.com/playlist/'+playlist['PLAYLIST_ID']+'/image',
|
||||||
|
'picture_small': 'https://e-cdns-images.dzcdn.net/images/'+playlist['PICTURE_TYPE']+'/'+playlist['PLAYLIST_PICTURE']+'/56x56-000000-80-0-0.jpg',
|
||||||
|
'picture_medium': 'https://e-cdns-images.dzcdn.net/images/'+playlist['PICTURE_TYPE']+'/'+playlist['PLAYLIST_PICTURE']+'/250x250-000000-80-0-0.jpg',
|
||||||
|
'picture_big': 'https://e-cdns-images.dzcdn.net/images/'+playlist['PICTURE_TYPE']+'/'+playlist['PLAYLIST_PICTURE']+'/500x500-000000-80-0-0.jpg',
|
||||||
|
'picture_xl': 'https://e-cdns-images.dzcdn.net/images/'+playlist['PICTURE_TYPE']+'/'+playlist['PLAYLIST_PICTURE']+'/1000x1000-000000-80-0-0.jpg',
|
||||||
|
'tracklist': 'https://api.deezer.com/playlist/'+playlist['PLAYLIST_ID']+'/tracks',
|
||||||
|
'creator': {
|
||||||
|
'id': playlist['PARENT_USER_ID'],
|
||||||
|
'name': playlist['PARENT_USERNAME'] if 'PARENT_USERNAME' in playlist else self.user['name']
|
||||||
|
},
|
||||||
|
'type': 'playlist'
|
||||||
|
}
|
||||||
|
result.append(item)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def get_user_albums_gw(self, user_id):
|
||||||
|
data = self.gw_api_call('deezer.pageProfile', {'user_id': user_id, 'tab': 'albums', 'nb': -1})['results']['TAB']['albums']['data']
|
||||||
|
result = []
|
||||||
|
for album in data:
|
||||||
|
item = {
|
||||||
|
'id': album['ALB_ID'],
|
||||||
|
'title': album['ALB_TITLE'],
|
||||||
|
'link': 'https://www.deezer.com/album/'+album['ALB_ID'],
|
||||||
|
'cover': 'https://api.deezer.com/album/'+album['ALB_ID']+'/image',
|
||||||
|
'cover_small': 'https://e-cdns-images.dzcdn.net/images/cover/'+album['ALB_PICTURE']+'/56x56-000000-80-0-0.jpg',
|
||||||
|
'cover_medium': 'https://e-cdns-images.dzcdn.net/images/cover/'+album['ALB_PICTURE']+'/250x250-000000-80-0-0.jpg',
|
||||||
|
'cover_big': 'https://e-cdns-images.dzcdn.net/images/cover/'+album['ALB_PICTURE']+'/500x500-000000-80-0-0.jpg',
|
||||||
|
'cover_xl': 'https://e-cdns-images.dzcdn.net/images/cover/'+album['ALB_PICTURE']+'/1000x1000-000000-80-0-0.jpg',
|
||||||
|
'tracklist': 'https://api.deezer.com/album/'+album['ALB_ID']+'/tracks',
|
||||||
|
'explicit_lyrics': album['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'] > 0,
|
||||||
|
'artist': {
|
||||||
|
'id': album['ART_ID'],
|
||||||
|
'name': album['ART_NAME'],
|
||||||
|
'picture': 'https://api.deezer.com/artist/'+album['ART_ID']+'image',
|
||||||
|
'tracklist': 'https://api.deezer.com/artist/'+album['ART_ID']+'/top?limit=50'
|
||||||
|
},
|
||||||
|
'type': 'album'
|
||||||
|
}
|
||||||
|
result.append(item)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def get_user_artists_gw(self, user_id):
|
||||||
|
data = self.gw_api_call('deezer.pageProfile', {'user_id': user_id, 'tab': 'artists', 'nb': -1})['results']['TAB']['artists']['data']
|
||||||
|
result = []
|
||||||
|
for artist in data:
|
||||||
|
item = {
|
||||||
|
'id': artist['ART_ID'],
|
||||||
|
'name': artist['ART_NAME'],
|
||||||
|
'link': 'https://www.deezer.com/artist/'+artist['ART_ID'],
|
||||||
|
'picture': 'https://api.deezer.com/artist/'+artist['ART_ID']+'/image',
|
||||||
|
'picture_small': 'https://e-cdns-images.dzcdn.net/images/artist/'+artist['ART_ID']+'/56x56-000000-80-0-0.jpg',
|
||||||
|
'picture_medium': 'https://e-cdns-images.dzcdn.net/images/artist/'+artist['ART_ID']+'/250x250-000000-80-0-0.jpg',
|
||||||
|
'picture_big': 'https://e-cdns-images.dzcdn.net/images/artist/'+artist['ART_ID']+'/500x500-000000-80-0-0.jpg',
|
||||||
|
'picture_xl': 'https://e-cdns-images.dzcdn.net/images/artist/'+artist['ART_ID']+'/1000x1000-000000-80-0-0.jpg',
|
||||||
|
'nb_fan': artist['NB_FAN'],
|
||||||
|
'tracklist': 'https://api.deezer.com/artist/'+artist['ART_ID']+'/top?limit=50',
|
||||||
|
'type': 'artist'
|
||||||
|
}
|
||||||
|
result.append(item)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def get_user_tracks_gw(self, user_id):
|
||||||
|
data = self.gw_api_call('deezer.pageProfile', {'user_id': user_id, 'tab': 'loved', 'nb': -1})['results']['TAB']['loved']['data']
|
||||||
|
result = []
|
||||||
|
for track in data:
|
||||||
|
item = {
|
||||||
|
'id': track['SNG_ID'],
|
||||||
|
'title': track['SNG_TITLE'],
|
||||||
|
'link': 'https://www.deezer.com/track/'+track['SNG_ID'],
|
||||||
|
'duration': track['DURATION'],
|
||||||
|
'rank': track['RANK_SNG'],
|
||||||
|
'explicit_lyrics': int(track['EXPLICIT_LYRICS']) > 0,
|
||||||
|
'explicit_content_lyrics': track['EXPLICIT_TRACK_CONTENT']['EXPLICIT_COVER_STATUS'],
|
||||||
|
'explicit_content_cover': track['EXPLICIT_TRACK_CONTENT']['EXPLICIT_LYRICS_STATUS'],
|
||||||
|
'time_add': track['DATE_ADD'],
|
||||||
|
'album': {
|
||||||
|
'id': track['ALB_ID'],
|
||||||
|
'title': track['ALB_TITLE'],
|
||||||
|
'cover': 'https://api.deezer.com/album/'+track['ALB_ID']+'/image',
|
||||||
|
'cover_small': 'https://e-cdns-images.dzcdn.net/images/cover/'+track['ALB_PICTURE']+'/56x56-000000-80-0-0.jpg',
|
||||||
|
'cover_medium': 'https://e-cdns-images.dzcdn.net/images/cover/'+track['ALB_PICTURE']+'/250x250-000000-80-0-0.jpg',
|
||||||
|
'cover_big': 'https://e-cdns-images.dzcdn.net/images/cover/'+track['ALB_PICTURE']+'/500x500-000000-80-0-0.jpg',
|
||||||
|
'cover_xl': 'https://e-cdns-images.dzcdn.net/images/cover/'+track['ALB_PICTURE']+'/1000x1000-000000-80-0-0.jpg',
|
||||||
|
'tracklist': 'https://api.deezer.com/album/'+track['ALB_ID']+'/tracks',
|
||||||
|
'type': 'album'
|
||||||
|
},
|
||||||
|
'artist': {
|
||||||
|
'id': track['ART_ID'],
|
||||||
|
'name': track['ART_NAME'],
|
||||||
|
'picture': 'https://api.deezer.com/artist/'+track['ART_ID']+'/image',
|
||||||
|
'picture_small': 'https://e-cdns-images.dzcdn.net/images/artist/'+track['ART_PICTURE']+'/56x56-000000-80-0-0.jpg',
|
||||||
|
'picture_medium': 'https://e-cdns-images.dzcdn.net/images/artist/'+track['ART_PICTURE']+'/250x250-000000-80-0-0.jpg',
|
||||||
|
'picture_big': 'https://e-cdns-images.dzcdn.net/images/artist/'+track['ART_PICTURE']+'/500x500-000000-80-0-0.jpg',
|
||||||
|
'picture_xl': 'https://e-cdns-images.dzcdn.net/images/artist/'+track['ART_PICTURE']+'/1000x1000-000000-80-0-0.jpg',
|
||||||
|
'tracklist': 'https://api.deezer.com/artist/'+track['ART_ID']+'/top?limit=50',
|
||||||
|
'type': 'artist'
|
||||||
|
},
|
||||||
|
'type': 'track'
|
||||||
|
}
|
||||||
|
result.append(item)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def get_user_playlists(self, user_id):
|
||||||
return self.api_call('user/' + str(user_id) + '/playlists', {'limit': -1})
|
return self.api_call('user/' + str(user_id) + '/playlists', {'limit': -1})
|
||||||
|
|
||||||
def get_track(self, user_id):
|
def get_user_albums(self, user_id):
|
||||||
return self.api_call('track/' + str(user_id))
|
return self.api_call('user/' + str(user_id) + '/albums', {'limit': -1})
|
||||||
|
|
||||||
|
def get_user_artists(self, user_id):
|
||||||
|
return self.api_call('user/' + str(user_id) + '/artists', {'limit': -1})
|
||||||
|
|
||||||
|
def get_user_tracks(self, user_id):
|
||||||
|
return self.api_call('user/' + str(user_id) + '/tracks', {'limit': -1})
|
||||||
|
|
||||||
|
def get_track(self, sng_id):
|
||||||
|
return self.api_call('track/' + str(sng_id))
|
||||||
|
|
||||||
def get_track_by_ISRC(self, isrc):
|
def get_track_by_ISRC(self, isrc):
|
||||||
return self.api_call('track/isrc:' + isrc)
|
return self.api_call('track/isrc:' + isrc)
|
||||||
|
|
||||||
def get_charts_countries(self):
|
def get_charts_countries(self):
|
||||||
temp = self.get_user_playlist('637006841')['data']
|
temp = self.get_user_playlists('637006841')['data']
|
||||||
result = sorted(temp, key=lambda k: k['title'])
|
result = sorted(temp, key=lambda k: k['title'])
|
||||||
if not result[0]['title'].startswith('Top'):
|
if not result[0]['title'].startswith('Top'):
|
||||||
result = result[1:]
|
result = result[1:]
|
||||||
|
|
Loading…
Reference in New Issue