Page 1 of 1

Pre-queue script output

Posted: March 14th, 2011, 5:14 pm
by Rooster242
I'm writing pre-queue script in python to clear up disk space before downloading. I'm outputting to the console (using the print keyword) like I would for a post-processing script.  Will I be able to see the output of the pre-queue script in the download history or should I be outputting to a log file instead?

Also, exit codes...
"If the script has an exit code other than 0, it's assumed the script failed and the NZB will be accepted.
Exit code 0 will make SABnzbd inspect the returned output."

I basically need to tell SABnzbd to either go ahead and process the NZB or don't.  0 to go ahead, -1 to stop?

Thanks for adding this feature by the way, it's just what I needed!

Re: Pre-queue script output

Posted: March 14th, 2011, 5:22 pm
by shypike
You won't see the console output in the log.
A trivial accept script for Windows is this:

Code: Select all

@echo off
echo 1
"echo 0" will refuse the NZB.
The exit code is inspected only to prevent a failing script from blocking new entries.

BTW: If your disk is full, do you really want to refuse the NZB's and therefor lose them?
You can set a threshold below which SABnzbd will automatically stop downloading.

Re: Pre-queue script output

Posted: March 14th, 2011, 5:45 pm
by Rooster242
I'm writing the script to interface with XBMC. Basically it will free enough space for the new download or if no more space can be freed then send a notice to XBMC.

Now that I think about it though it would be nice if SABnzbd would queue the nzb until the user clears up enough space for the download.  I can probably accomplish this by having my script always echo 1 and and set a threshold limit in SABnzbd.  Yeah?  If the threshold is reached and the download gets auto-paused will I have to manually start the download again after I've cleared some space or will it automatically un-pause after it detects enough space for it?

Re: Pre-queue script output

Posted: March 15th, 2011, 2:49 am
by shypike
What you describe will work.
Only it won't automatically resume once disk space is available again.