Bugzilla – Bug 8354
Prevent Standby Plugin only checks the status of the first player
Last modified: 2008-06-13 14:45:21 UTC
I'm a bit confused about versions since the SVN changes - but I do know that I'm on r20269 checked out from http://svn.slimdevices.com/repos/slim/7.0/trunk/server on Windows Vista. Unless I'm mistaken (quite possible!), the "Windows: Prevent System Standby While Playing" plugin only checks the play mode status of the first client returned by "Slim::Player::Client::clients()". Within "sub checkClientActivity", the block that is "for my $client (Slim::Player::Client::clients()) {" only ever checks the status the first player (alpha sorted, I think). Changing the line to "foreach my $client (Slim::Player::Client::clients()) {" makes the plugin interate through the list of players. Sorry for my bad Perl terminology. Hopefully this makes sense. Thanks.
Created attachment 3429 [details] Adds foreach to make the plugin check all players
for does the same thing as foreach. The 'catch' here is the return inside of the loop. This will be executed after the first client found that isn't either stopped or paused. This isn't a problem since the check is designed to see if ANY players are actively playing. If one is, there is no need to check the rest. Hope that clears up the confusion. If you are seeing some other problems with this, please reopen.
Thanks for the sanity check. I've just checked the debug log and the behaviour you described is exhibited. The funny thing is I'm sure that, when I looked at the logs the first time, it was only ever logging an entry for the first player. Must have had a bad moment.
Perhaps that one player was in a playmode other than stop or pause. If that was the case, then it would have returned after just that one. Note that there are many play modes besides just 'play' that fall into 'not stop' and 'not pause'. Keep an eye on it and report back if you see it again.
I think you're right. I *was* playing round using Slim::Buttons::Common::mode ($client) and altering the regex at the time (to check the power status to keep the server alive when any player was not off) and I confused myself. I've got that working now, so I'm very happy. Sorry for the noise.