Display artist in albums (optional, default disabled)

This commit is contained in:
localhost_frssoft 2022-11-14 23:05:19 +03:00
parent 5a61354112
commit d5e8342da6
2 changed files with 10 additions and 3 deletions

View file

@ -1,5 +1,6 @@
from src.fw_api import get_artists, get_tracks, get_albums, concatinate_endpoint
import src.fw_artists 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 src.mpv_control import player, player_menu
from pyfzf.pyfzf import FzfPrompt from pyfzf.pyfzf import FzfPrompt
from loguru import logger from loguru import logger
@ -8,6 +9,7 @@ fzf = FzfPrompt()
@logger.catch @logger.catch
def list_albums(albums=None, pg=None, search=None, artist=None, include_channels=None, refresh=False): 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_next = None
albums_prev = None albums_prev = None
play_artist_albums = False 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: for i in albums_results:
index = albums_results.index(i) index = albums_results.index(i)
album_name = i.get('title') 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] select = fzf.prompt(view)[0].split('.', 1)[0]
if select == 'Next page': if select == 'Next page':
list_albums(pg=albums_next) list_albums(pg=albums_next)

View file

@ -39,7 +39,8 @@ default_conf = {
"shitnoise.monster" "shitnoise.monster"
], ],
'prefetch_playlist': True, 'prefetch_playlist': True,
'show_like_button': True 'show_like_button': True,
'show_artist_name_in_albums': False
} }