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 @logger.catch
def get_artists(page=None, q=None, artist=None, album=None, 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''' '''This function get artists by params'''
params = { params = {
'page': page, 'page': page,
@ -167,6 +167,7 @@ def get_artists(page=None, q=None, artist=None, album=None,
'artist': artist, 'artist': artist,
'album': album, 'album': album,
'library': library, 'library': library,
'scope': scope,
'favourites': favourites, 'favourites': favourites,
'refresh': refresh 'refresh': refresh
} }

View file

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