ralph-irving / squeezelite

Lightweight headless squeezebox player for Lyrion Media Server
https://sourceforge.net/projects/lmsclients/files/squeezelite/
Other
391 stars 98 forks source link

Power controls (gpio/script) tied to output device being open rather than soft power button state #205

Open 986ster opened 10 months ago

986ster commented 10 months ago

I discovered, through using the -C option, and with some help from @paul-1, that the functionality to set the GPIO pin status or execute the power scripts is actually tied to the output stream being open, rather than mirroring the state of the soft power button.

If you don't use the -C option then this pretty well tracks the soft power button, but if you do use -C then the power on instruction won't be issued by Squeezelite until a track actually starts playing, and then will terminate n number of seconds after playback has finished per the -C value.

This isn't ideal for controlling a power amplifier, which really wants to track the power button status on Squeezelite. You don't want it turning off 5 seconds after a track has finished playing (if you're using a typical -C 5 value), and if it has any sort of mute circuit then you'll miss the beginning of the music when it starts playing, even if you've previously powered on the player through LMS (because this won't have triggered the amplifier at this stage).

I think it would be much better if the -G and -S options would follow the soft power button status only of the particuar player, and ignore the stream output status. You can get the player to automatically power off quickly if you want that by using the Powersave plugin anyway, so I can't see what value having this track the output stream status might be.