Fix volume

This commit is contained in:
ABelliqueux 2025-01-04 11:28:11 +01:00
parent 4a6fb79c21
commit 51ea4af2f5
1 changed files with 11 additions and 4 deletions

View File

@ -379,8 +379,9 @@ def main(args):
# ~ songs_from_album = client.list('title', 'album', album_by_x[x])
# Set Init volume in encoder and mpd
enc.setCounter(init_volume)
client.setvol(init_volume)
volume = init_volume
enc.setCounter(volume)
client.setvol(volume)
offset_polygons(MODES)
global ui_vol_icon_polygon
@ -388,9 +389,15 @@ def main(args):
global static_ui
static_ui = generate_static_ui(current_mode)
while ctrlc_pressed is False:
global volume
# Rotary encoder
client.setvol(int(enc.getValue()))
cur_vol = int(client.getvol()['volume'])
if cur_vol != volume:
volume = cur_vol
elif int(enc.getValue()) != volume:
volume = int(enc.getValue())
client.setvol(volume)
enc.setCounter(volume)
#ui_idle_for = 0
# MPD
mpd_status = client.status()