From d5e8342da61b7bc092fba3ca685700052f68e22f Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 14 Nov 2022 23:05:19 +0300 Subject: [PATCH] Display artist in albums (optional, default disabled) --- src/fw_albums.py | 10 ++++++++-- src/settings.py | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/fw_albums.py b/src/fw_albums.py index 4c3a8f3..93a3942 100644 --- a/src/fw_albums.py +++ b/src/fw_albums.py @@ -1,5 +1,6 @@ -from src.fw_api import get_artists, get_tracks, get_albums, concatinate_endpoint import src.fw_artists +from src.fw_api import get_artists, get_tracks, get_albums, concatinate_endpoint +from src.settings import get_config from src.mpv_control import player, player_menu from pyfzf.pyfzf import FzfPrompt from loguru import logger @@ -8,6 +9,7 @@ fzf = FzfPrompt() @logger.catch def list_albums(albums=None, pg=None, search=None, artist=None, include_channels=None, refresh=False): + show_artist_name_in_albums = get_config('show_artist_name_in_albums') albums_next = None albums_prev = None play_artist_albums = False @@ -32,7 +34,11 @@ def list_albums(albums=None, pg=None, search=None, artist=None, include_channels for i in albums_results: index = albums_results.index(i) album_name = i.get('title') - view.append(f'{index}.{album_name}') + artist_name = i.get('artist').get('name') + option_str = f'{index}.{album_name}' + if show_artist_name_in_albums: + option_str += f' | Artist: {artist_name}' + view.append(f'{option_str}') select = fzf.prompt(view)[0].split('.', 1)[0] if select == 'Next page': list_albums(pg=albums_next) diff --git a/src/settings.py b/src/settings.py index f73eb19..beb7205 100644 --- a/src/settings.py +++ b/src/settings.py @@ -39,7 +39,8 @@ default_conf = { "shitnoise.monster" ], 'prefetch_playlist': True, - 'show_like_button': True + 'show_like_button': True, + 'show_artist_name_in_albums': False }