Page 1 of 1
SABnzbd pass variables to python?
Posted: January 19th, 2010, 6:25 pm
by tret
According to the SABnzbd manual, SABnzbd will pass parameters related to the finished job to the user defined script.
The script will receive these parameters. Use %1 in Windows scripts and $1 in Unix scripts.
I would like to utilize the information passed in these parameters but I'm unsure as to if this works and if so what the python variables are. Does anyone have experience with this?
Thanks,
Rob
Re: SABnzbd pass variables to python?
Posted: January 20th, 2010, 1:57 am
by JohnSCS
The manual refers to shell scripts. ie, DOS batch file uses %1 %2 etc. Unix uses $1 $2 etc. Python uses a function to retrieve the variable.
Python SABnzbd
sys.argv[1] 1-The final directory of the job (full path)
sys.argv[2] 2-The name of the NZB file
sys.argv[3] 3-Clean version of the job name (no path info and ".nzb" removed)
sys.argv[4] 4-Newzbin report number (may be empty
sys.argv[5] 5-Newzbin or user-defined category
sys.argv[6] 6-Group that the NZB was posted in e.g. alt.binaries.x
Python Example - Get final folder name from SAB
Python Example - Get clean NZB job name from SAB
Hope this helps.
Re: SABnzbd pass variables to python?
Posted: January 20th, 2010, 10:03 am
by tret
exactly what I was looking for, thanks!
Re: SABnzbd pass variables to python?
Posted: January 21st, 2010, 4:28 pm
by tret
Does SABnzbd also pass any details about the job. I'd like to be able to have information about if the job finished with no errors or if the job failed. It'd also be nice to know if the extraction failed because of password protection, etc.
Thanks,
Rob
Re: SABnzbd pass variables to python?
Posted: January 24th, 2010, 10:25 am
by imthenachoman
...removed because I was wrong.