Philip Meyer;437176 Wrote:
> >==>New settings option: Push players to SqueezeNetwork on “external”
> >shutdown [X]
>
> Wow, sounds good. Curious - how do you achieve that miracle?
It's a lot less miraculous than it sounds:
I noticed some months ago that PreventStandby implemented a
'shutdownPlugin' function. I never really pondered what this might be
able to accomplish until fredbloggs got me thinking. As far as I can
tell, SC calls these functions (if it finds them) in all plugins...and
calls them early enough in the shutdown process that you can get real
work done. This is what I'm doing:
Code:
--------------------
sub shutdownPlugin {
my ($class) = @_;
# Are we here becuase of an external event?
if ( ! $g{hPreviousAction} ) {
#Plugin is shutting down because of some external cause...so
take these actions..
$g{log}->debug( "$class \"externally\" initiated shutdown.");
#Set rtc wake alarm
if ( $g{prefs}->bSetRTCWakeForAlarm ) {
Plugins::SrvrPowerCtrl::Alarms::SetRTCWakeup();
}
#Turn off players...
if ( $g{prefs}->bPowerOffPlayers ) {
Plugins::SrvrPowerCtrl::Util::PowerOffPlayer();
}
#Send players to SqueezeNetwork..
if ( $g{prefs}->{bOnXShutdownGotoSN} ) {
Plugins::SrvrPowerCtrl::Util::PushToSqueezeNetwork();
}
#Perform the xCmd:
Plugins::SrvrPowerCtrl::Util::SystemExecCmd(
$g{prefs}->{szOnXShutdown_cmd} );
} else {
# Nope, we're here because of one of our actions..
$g{log}->debug( "$class self initiated " .
$g{hPreviousAction}->{action} . ".");
}
# Kill the watchdogs' timer
Plugins::SrvrPowerCtrl::Watchdog::ActivateSPCWatchdog(0);
}
--------------------
--
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=48521
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins