From e2f07a7a35e4d49ffcf1ce04e1dbcbcddb6cc61d Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 18 Jun 2023 01:34:02 +0300 Subject: [PATCH] Tag selector for artists menu --- src/fw_api.py | 3 ++- src/fw_artists.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/fw_api.py b/src/fw_api.py index 9705dfa..fc7f697 100644 --- a/src/fw_api.py +++ b/src/fw_api.py @@ -170,7 +170,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, +def get_artists(page=None, q=None, artist=None, album=None, tag=None, library=None, scope=None, favourites=None, refresh=False, pg=None): '''This function get artists by params''' params = { @@ -178,6 +178,7 @@ def get_artists(page=None, q=None, artist=None, album=None, 'q': q, 'artist': artist, 'album': album, + 'tag': tag, 'library': library, 'scope': scope, 'favourites': favourites, diff --git a/src/fw_artists.py b/src/fw_artists.py index 3e52b1f..d97c763 100644 --- a/src/fw_artists.py +++ b/src/fw_artists.py @@ -2,6 +2,7 @@ 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.fw_tags import list_tags from src.mpv_control import player, player_menu, track_url_to_uuid from pyfzf.pyfzf import FzfPrompt from loguru import logger @@ -10,12 +11,12 @@ fzf = FzfPrompt() @logger.catch -def list_artists(pg=None, search=None, library=None, scope=None): - artists = get_artists(q=search, library=library, pg=pg, scope=scope) +def list_artists(pg=None, search=None, library=None, scope=None, tag=None): + artists = get_artists(q=search, library=library, pg=pg, scope=scope, tag=tag) artists_next = artists.get('next') artists_prev = artists.get('previous') artists_results = artists.get('results') - view = ['Search', 'Library', 'Limit by scope'] + view = ['Search', 'Tag', 'Library', 'Limit by scope'] if artists_next: view.append('Next page') if artists_prev: @@ -39,6 +40,8 @@ def list_artists(pg=None, search=None, library=None, scope=None): elif select == 'Search': print('Search by artist:') list_artists(search=input()) + elif select == 'Tag': + list_artists(tag=list_tags()) elif select == 'Library': select_lib = libraries() list_artists(library=select_lib)