diff --git a/mpdlisten.py b/mpdlisten.py index 58445b0..0c69575 100644 --- a/mpdlisten.py +++ b/mpdlisten.py @@ -191,6 +191,7 @@ def update_display(device, currentsong, status): def send_mpd_cmd(client, cmd:str): + idle_states = ['stop', 'pause'] if cmd == 'menu': global current_mode current_mode_index = MODES_ORDER.index(current_mode) @@ -203,11 +204,16 @@ def send_mpd_cmd(client, cmd:str): global static_ui static_ui = generate_static_ui(current_mode) if cmd == 'prev': - client.previous() + if client.status()['state'] != 'stop': + client.previous() elif cmd == 'next': - client.next() + if client.status()['state'] != 'stop': + client.next() elif cmd == 'toggle': - client.pause() + if client.status()['state'] in idle_states: + client.play() + else: + client.pause() elif cmd == 'stop': client.stop() else: