Bug 8354 - Prevent Standby Plugin only checks the status of the first player
: Prevent Standby Plugin only checks the status of the first player
Status: RESOLVED INVALID
Product: Logitech Media Server
Classification: Unclassified
Component: Plugin
: 7.0.1
: PC Windows Vista
: -- normal (vote)
: ---
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-07 12:41 UTC by Nigel Birch
Modified: 2008-06-13 14:45 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
Adds foreach to make the plugin check all players (4.97 KB, patch)
2008-06-13 12:18 UTC, Nigel Birch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nigel Birch 2008-06-07 12:41:39 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.
Comment 1 Nigel Birch 2008-06-13 12:18:17 UTC
Created attachment 3429 [details]
Adds foreach to make the plugin check all players
Comment 2 KDF 2008-06-13 13:03:27 UTC
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.
Comment 3 Nigel Birch 2008-06-13 14:31:12 UTC
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.
Comment 4 KDF 2008-06-13 14:35:55 UTC
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.  

Comment 5 Nigel Birch 2008-06-13 14:45:21 UTC
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.