PDA

View Full Version : PreventStandby Plugin why exclude pause and stop?



mswlogo
2007-03-05, 23:13
In PreventStandby plugin.pm

Why do you not preventstandy if Paused or Stopped.

I can maybe understand Stopped, but paused.

The phone rings, I hit pause, I take the call, I finish call I go to hit play and the server is gone !!!

I Took Pause out on my system.

Is it safe to take Stop out too?

Only when I shut the squeezebox off would I want the server to shutdown (i.e. during screen saver).

If you think folks want this feature let them set the timeout for pause and stop and allow it to be infinity (i.e. don't treat pause and stop special).

Code is below.

sub checkClientActivity {

$timer = undef;

for my $client (Slim::Player::Client::clients()) {

my $playmode = $client->playmode();

$::d_plugins && msgf("Prevent Standby plugin: client %s in playmode %s\n", $client->name, $playmode);

if ($playmode ne 'stop' && $playmode ne 'pause') {

$::d_plugins && msg("Prevent Standby plugin: setting thread execution state\n");

if (defined $SetThreadExecutionState) {
$SetThreadExecutionState->Call(1);
}

startTimer();

return 1;
}
}

startTimer();

return 0;
}

oreillymj
2007-03-08, 04:35
Actually one of the most annoying things about WOL, which this plugin does not address, is that if you spend more than 1 or 2 minutes picking music, without having something already playing, then the machine will return back to sleep.

So actaully taking the pause condition out of the checkClientActivity function means that when my pc comes out of standby, it will remain on while I pick a new selection, so long as the player is paused.

NigelMSB
2007-03-31, 03:01
If the problem is that Windows is dumb, and treats idling to sleep after a WoL resume differently to a normal idle to sleep (i.e. uses a 2 minute idle rather than the control panel power options setting), why not prevent idling when any player is powered on? That is, rather than use $client->playmode(); (which I assume is playing/paused/stopped), use the power state of the player (on/off)?

Assuming I'm not missing something, is there a function that returns the power state of a player?

NigelMSB
2008-06-13, 14:55
If the problem is that Windows is dumb, and treats idling to sleep after a WoL resume differently to a normal idle to sleep (i.e. uses a 2 minute idle rather than the control panel power options setting), why not prevent idling when any player is powered on? That is, rather than use $client->playmode(); (which I assume is playing/paused/stopped), use the power state of the player (on/off)?
I finally got round to using WoL and altering the Prevent Standy plugin to keep the server awake when any player is powered on. For me (with my limited testing), it works great with the PowerSave plugin to power players off after 15 minutes on either stopped or paused. Players power off after 15 minutes and the server then sleeps after either the Windows idle period or 2 minutes (depending on how it feels).

I've attached a patch against http://svn.slimdevices.com/repos/slim/7.0/trunk/server in case it's useful for anyone else.

NigelMSB
2008-06-13, 14:56
The missing attachment.

kdf
2008-06-13, 15:20
>
> The missing attachment.

Nigel,

Your patch has mismatched line endings, so it comes up as a total
replacement of all lines, rather than just the changes. SC uses unix
style line endings as a standard. Programs like TextEdit and UltraEdit
can convert from DOS to unix endings.

-kdf

NigelMSB
2008-06-14, 00:33
Your patch has mismatched line endings, so it comes up as a total
replacement of all lines, rather than just the changes. SC uses unix
style line endings as a standard. Programs like TextEdit and UltraEdit
can convert from DOS to unix endings.
I noticed that and was wondering... Better not use WordPad in future. :-) Here's a new patch. Thanks again.

kdf
2008-06-15, 15:06
On 14-Jun-08, at 12:33 AM, NigelMSB wrote:

>
> kdf;311717 Wrote:
>> Your patch has mismatched line endings, so it comes up as a total
>> replacement of all lines, rather than just the changes. SC uses unix
>> style line endings as a standard. Programs like TextEdit and
>> UltraEdit
>> can convert from DOS to unix endings.
>> I noticed that and was wondering... Better not use WordPad in
>> future.
> :-) Here's a new patch. Thanks again.
>

That's better. A few notes:

- I'm not sure that all modes will have 'off' in the name when the
player is off. Remember, the users can choose the off screensaver.
- This does mean that the players must be 'off' for the standby to be
allowed. If all players are simply stopped, left in idle or 'not
playing' mode, this keeps the server active.

It's a change in ideology as to the right state to allow automatic
power down. I believe the original idea was to stop Windows from
shutting down when users were actively playing or had paused it for
later. Now, given that turning a player off will essentially pause
play as well, the existing solution may not be the complete solution
either.

Best to file an enhancement and attach the patch so that it can be
reviewed along with the intended behaviour.

-kdf

NigelMSB
2008-06-20, 11:57
- I'm not sure that all modes will have 'off' in the name when the
player is off. Remember, the users can choose the off screensaver.
I noticed that the Date/Time one is "off.datetime". If the mode of the state is defined by the screensaver then it could be a problem with third-party ones.



- This does mean that the players must be 'off' for the standby to be
allowed. If all players are simply stopped, left in idle or 'not
playing' mode, this keeps the server active.
That's the idea (for my usage case).



It's a change in ideology as to the right state to allow automatic
power down. I believe the original idea was to stop Windows from
shutting down when users were actively playing or had paused it for
later. Now, given that turning a player off will essentially pause
play as well, the existing solution may not be the complete solution
either.The problem with the current behaviour is that Windows has an annoying 2-minute timeout when resuming from S3. So, if one powers on the server via WoL and is browsing for music (with nothing playing) for more than 2 minutes, the server can go to sleep in the middle before music starts to play.


Best to file an enhancement and attach the patch so that it can be
reviewed along with the intended behaviour.Yep, will do.

NigelMSB
2008-06-20, 12:31
I've created bug 8520 for this.

gharris999
2009-01-03, 16:00
I have a different proposed fix for this problem. Please see: http://forums.slimdevices.com/showthread.php?t=57632