Fix send_mpd_cmd

This commit is contained in:
ABelliqueux 2024-03-20 11:48:35 +01:00
parent 71338cd17f
commit 6166140c12
1 changed files with 9 additions and 3 deletions

View File

@ -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: