SABnzbd pass variables to python?

Come up with a useful post-processing script? Share it here!
Post Reply
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

SABnzbd pass variables to python?

Post 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
JohnSCS
Newbie
Newbie
Posts: 42
Joined: August 17th, 2009, 12:23 am

Re: SABnzbd pass variables to python?

Post 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

Code: Select all

full_path = sys.argv[1]
Python Example - Get clean NZB job name from SAB

Code: Select all

job_name = sys.argv[3]
Hope this helps.
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: SABnzbd pass variables to python?

Post by tret »

exactly what I was looking for, thanks!
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: SABnzbd pass variables to python?

Post 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
imthenachoman
Jr. Member
Jr. Member
Posts: 59
Joined: March 2nd, 2009, 10:58 am
Contact:

Re: SABnzbd pass variables to python?

Post by imthenachoman »

...removed because I was wrong.
Post Reply