limit by scope for artists selector

This commit is contained in:
localhost_frssoft 2023-06-12 14:30:49 +03:00
parent 6a816ea853
commit 88d619f304
3 changed files with 11 additions and 5 deletions

View File

@ -159,7 +159,7 @@ def get_recently_listened(page=None, q=None, scope=None, include_channels=None,
@logger.catch
def get_artists(page=None, q=None, artist=None, album=None,
library=None, favourites=None, refresh=False, pg=None):
library=None, scope=None, favourites=None, refresh=False, pg=None):
'''This function get artists by params'''
params = {
'page': page,
@ -167,6 +167,7 @@ def get_artists(page=None, q=None, artist=None, album=None,
'artist': artist,
'album': album,
'library': library,
'scope': scope,
'favourites': favourites,
'refresh': refresh
}

View File

@ -1,4 +1,5 @@
from src.fw_api import get_artists, get_tracks, get_audio_file
from src.fw_api_hints import hint_scope
from src.fw_albums import list_albums
from src.fw_libraries import libraries
from src.mpv_control import player, player_menu, track_url_to_uuid
@ -9,12 +10,12 @@ fzf = FzfPrompt()
@logger.catch
def list_artists(pg=None, search=None, library=None):
artists = get_artists(q=search, library=library, pg=pg)
def list_artists(pg=None, search=None, library=None, scope=None):
artists = get_artists(q=search, library=library, pg=pg, scope=scope)
artists_next = artists.get('next')
artists_prev = artists.get('previous')
artists_results = artists.get('results')
view = ['Search', 'Library']
view = ['Search', 'Library', 'Limit by scope']
if artists_next:
view.append('Next page')
if artists_prev:
@ -36,6 +37,10 @@ def list_artists(pg=None, search=None, library=None):
elif select == 'Library':
select_lib = libraries()
list_artists(library=select_lib)
elif select == 'Limit by scope':
hint_scope()
scope = input()
list_artists(scope=scope)
else:
albums = artists_results[int(select)].get('albums')
if albums:

View File

@ -1,6 +1,6 @@
from src.fw_api import get_favorires_tracks, get_recently_listened, get_audio_file
from src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage
from src.fw_api_hints import hint_scope
from src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage
from pyfzf.pyfzf import FzfPrompt
from loguru import logger