From b74e5ce026d1eb8a908252b512f27b06df4d33bd Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Tue, 20 Dec 2022 04:33:29 +0300 Subject: [PATCH] Fix next track switch --- src/fw_radios.py | 6 +++++- src/mpv_control.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/fw_radios.py b/src/fw_radios.py index ce9eb69..0e66bd1 100644 --- a/src/fw_radios.py +++ b/src/fw_radios.py @@ -126,7 +126,11 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non if playlist_remaining <= 2: threading.Thread(target=radio_get_track, args=( radio_session_id,), daemon=True).start() - player.playlist_next() + if playlist_remaining > 1: + player.playlist_next() + else: + print('No more tracks, please wait for new...') + time.sleep(3) elif select == 'Prev': player.playlist_prev() elif select in ('Pause', 'Play'): diff --git a/src/mpv_control.py b/src/mpv_control.py index 7b2e296..2ce9164 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -85,7 +85,10 @@ def player_menu(header='', storage={}): select = fzf.prompt(player_items_menu, f"--header=\'{header}\'")[0] if select == 'Next': - player.playlist_next() + try: + player.playlist_next() + except: + print('No more next tracks') elif select == 'Prev': player.playlist_prev() elif select in ('Pause', 'Play'):