mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-25 11:01:27 +00:00
Channels parametrs, fix artist playing
This commit is contained in:
parent
3ea5a1fcb9
commit
b945793689
|
@ -7,15 +7,17 @@ from loguru import logger
|
|||
fzf = FzfPrompt()
|
||||
|
||||
@logger.catch
|
||||
def list_albums(albums=None, pg=None, search=None, artist=None, include_channels=None):
|
||||
def list_albums(albums=None, pg=None, search=None, artist=None, include_channels=None, refresh=False):
|
||||
albums_next = None
|
||||
albums_prev = None
|
||||
play_artist_albums = False
|
||||
if not albums:
|
||||
albums = get_albums(q=search, artist=artist, include_channels=include_channels, pg=pg)
|
||||
albums = get_albums(q=search, artist=artist, include_channels=include_channels, refresh=refresh, pg=pg)
|
||||
albums_next = albums.get('next')
|
||||
albums_prev = albums.get('previous')
|
||||
albums_results = albums.get('results')
|
||||
if artist:
|
||||
play_artist_albums = True
|
||||
else:
|
||||
play_artist_albums = True
|
||||
albums_results = albums
|
||||
|
@ -40,6 +42,9 @@ def list_albums(albums=None, pg=None, search=None, artist=None, include_channels
|
|||
print('Search by albums: ')
|
||||
list_albums(search=input())
|
||||
elif select == 'Play all':
|
||||
if artist:
|
||||
src.fw_artists.play_artist(artist)
|
||||
else:
|
||||
src.fw_artists.play_artist(albums_results[0].get('artist'))
|
||||
else:
|
||||
play_album(album_id=albums_results[int(select)].get('id'))
|
||||
|
|
|
@ -81,14 +81,15 @@ def get_tracks(page=None, q=None, artist=None, album=None, favourites=None, incl
|
|||
|
||||
|
||||
@logger.catch
|
||||
def get_artists(page=None, q=None, artist=None, album=None, favourites=None, pg=None):
|
||||
def get_artists(page=None, q=None, artist=None, album=None, favourites=None, refresh=False, pg=None):
|
||||
'''This function get artists by params'''
|
||||
params = {
|
||||
'page': page,
|
||||
'q': q,
|
||||
'artist': artist,
|
||||
'album': album,
|
||||
'favourites': favourites
|
||||
'favourites': favourites,
|
||||
'refresh': refresh
|
||||
}
|
||||
if pg:
|
||||
r = s.get(pg)
|
||||
|
@ -98,13 +99,14 @@ def get_artists(page=None, q=None, artist=None, album=None, favourites=None, pg=
|
|||
|
||||
|
||||
@logger.catch
|
||||
def get_albums(page=None, q=None, artist=None, include_channels=None, pg=None):
|
||||
def get_albums(page=None, q=None, artist=None, include_channels=None, refresh=False, pg=None):
|
||||
'''This function get artists by params'''
|
||||
params = {
|
||||
'page': page,
|
||||
'q': q,
|
||||
'artist': artist,
|
||||
'include_channels': include_channels
|
||||
'include_channels': include_channels,
|
||||
'refresh': refresh
|
||||
}
|
||||
if pg:
|
||||
r = s.get(pg)
|
||||
|
|
|
@ -35,7 +35,7 @@ def list_artists(pg=None, search=None):
|
|||
|
||||
|
||||
def play_artist(artist_id):
|
||||
tracks = get_tracks(artist=artist_id)
|
||||
tracks = get_tracks(artist=artist_id, include_channels=True)
|
||||
tracks_results = tracks.get('results')
|
||||
storage = {}
|
||||
for i in tracks_results:
|
||||
|
|
|
@ -31,4 +31,7 @@ def list_channels(pg=None, search=None):
|
|||
print('Search by channel:')
|
||||
list_channels(search=input())
|
||||
else:
|
||||
list_albums(artist=channels_results[int(select)].get('artist').get('id'), include_channels=True)
|
||||
refresh = False
|
||||
if channels_results[int(select)].get('artist').get('is_local') == False:
|
||||
refresh = True
|
||||
list_albums(artist=channels_results[int(select)].get('artist').get('id'), include_channels=True, refresh=refresh)
|
||||
|
|
Loading…
Reference in a new issue