diff --git a/src/mpv_control.py b/src/mpv_control.py index 1146830..27f841e 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -10,7 +10,7 @@ fzf = FzfPrompt() player = mpv.MPV() player.ytdl = False # Prevent attempts load track with yt-dlp player.prefetch_playlist = get_config('prefetch_playlist') # Fast loading next track, but high network traffic - +show_like_button = get_config('show_like_button') def set_http_header(headers=[]): player.http_header_fields = headers @@ -20,7 +20,13 @@ def set_http_header(headers=[]): def player_menu(header=None, storage={}): while True: try: - select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Info', 'Hide artist', 'Exit'), f"--header=\'{header}\'")[0] + player_items_menu = ['Next', 'Prev', 'Pause', + 'Download', 'Info'] + if show_like_button: + player_items_menu.append('Like') + player_items_menu.extend(['Hide artist', 'Exit']) + + select = fzf.prompt(player_items_menu, f"--header=\'{header}\'")[0] if select == 'Next': player.playlist_next() elif select == 'Prev': @@ -46,6 +52,8 @@ def player_menu(header=None, storage={}): if key and isinstance(key, str): print(i + ': ' + key) input() + elif select == 'Like': + src.fw_api.favorite_track(storage.get(player.filename).get('id')) elif select == 'Hide artist': track = storage.get(player.filename) src.fw_api.hide_content({'target': {'id': track.get('artist').get('id'), 'type': 'artist'}}) diff --git a/src/settings.py b/src/settings.py index dfb5ec4..f73eb19 100644 --- a/src/settings.py +++ b/src/settings.py @@ -38,7 +38,8 @@ default_conf = { "funkwhale.gegeweb.eu", "shitnoise.monster" ], - 'prefetch_playlist': True + 'prefetch_playlist': True, + 'show_like_button': True }