Page 1 of 1

Can I intercept hybernate and/or detect SAB idle state

Posted: June 29th, 2012, 7:56 pm
by Rblaker2012
Greetings,


I am looking for a way to programmaticly perform one or both of these functions for a sab install running on Windows 7.


1. Intercept the "On finish" command for hibernate so that I could run a bat file or my own exe when SAB tries to hibernate the system. I want to do some custom actions only when no downloads are active and no files are being acted upon.

Code: Select all

012-05-25 05:13:17,796::INFO::[postproc:619] Queue has finished, launching: <function system_hibernate at 0x017782F0> (None)
2. Programaticly detect that SAB has been idle for X min, at which time I could then do my custom actions.


I am not sure where I could start to monitor for these events/states. Does anyone have any ideas on what I could key off of.
I should mention, I know absolutely nothing about python. In my skills arsenal, this could be a DOS,VBS,VB6(trying to avoid), VB.net(still learning) or autoIT solution.

Thanks.

Re: Help With Categories

Posted: June 30th, 2012, 1:05 am
by shypike
You can set an end-of-queue script.
Use the arrow at te top right of the queue.
You can write the script in any language.
You will have to set a "scripts" folder in Config->Folders first and
put the script in that folder.

Re: Can I intercept hybernate and/or detect SAB idle state

Posted: June 30th, 2012, 11:32 am
by Rblaker2012
shypike, I looked at http://wiki.sabnzbd.org/user-scripts which states:
SABnzbd can run a user-provided script to be executed when a job has completed without errors.
but unless I'm mistaken this script would run after each and every item in the queue. The behavior I'm looking for is that my script would only run in the context of all jobs and processing are done.
This is why I was looking to see if I could hook in somehow to what drives the "hibernate" event because at least SAB is in a known state of idle.

So, Am I mistaken and the user scripts are an end of queue function or are they end of each job?

Thanks.

Re: Help With Categories

Posted: June 30th, 2012, 3:09 pm
by shypike
The end-of-job script and end-of-queue script are two separate things.