From 88d619f304122d2f256273bfbe284924aaf6a9e4 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 12 Jun 2023 14:30:49 +0300 Subject: [PATCH] limit by scope for artists selector --- src/fw_api.py | 3 ++- src/fw_artists.py | 11 ++++++++--- src/fw_recents.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/fw_api.py b/src/fw_api.py index 385a442..163e299 100644 --- a/src/fw_api.py +++ b/src/fw_api.py @@ -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 } diff --git a/src/fw_artists.py b/src/fw_artists.py index c40410d..ff024ac 100644 --- a/src/fw_artists.py +++ b/src/fw_artists.py @@ -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: diff --git a/src/fw_recents.py b/src/fw_recents.py index 76a82d9..348abf4 100644 --- a/src/fw_recents.py +++ b/src/fw_recents.py @@ -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