Pre_Process Script

Come up with a useful post-processing script? Share it here!
Post Reply
Spritzup
Newbie
Newbie
Posts: 6
Joined: March 18th, 2014, 6:28 pm

Pre_Process Script

Post by Spritzup »

Good Evening,

I'm looking to create a pre-process script that would do 2 things (both changing the priority to "force"). The first is to have any file added that's less than 50MB in size to be set to force. The second part of the script would be to check for anything that has category "TV" and that is set to "High" and change it to "Force".

Any assistance that you guys could provide would be very much appreciated.

Thanks!

~Spritz
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Pre_Process Script

Post by sander »

Spritzup wrote: I'm looking to create a pre-process script ...
OK. How far have you gotten in creating your script? Can you post it?

... or do you mean you want someone else to create the script for you? If so: I'm willing to write as long as it's in python.
Spritzup
Newbie
Newbie
Posts: 6
Joined: March 18th, 2014, 6:28 pm

Re: Pre_Process Script

Post by Spritzup »

sander wrote: OK. How far have you gotten in creating your script? Can you post it?

... or do you mean you want someone else to create the script for you? If so: I'm willing to write as long as it's in python.
I've simply sketched out some rough logic for it on a scrap of paper. I used to write bash scripts on a regular basis, but haven't done it in years.

And if you're offering to write me one, I would not say no... my one year old has decided that sleep is for the weak. And python is more than fine.

Thanks again!

~Spritz
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Pre_Process Script

Post by sander »

See the python script on http://wiki.sabnzbd.org/user-pre-queue-script ... does that work for you, as in: the pre-queue script *forces* <50MB downloads to be downloaded
Spritzup
Newbie
Newbie
Posts: 6
Joined: March 18th, 2014, 6:28 pm

Re: Pre_Process Script

Post by Spritzup »

sander wrote:See the python script on http://wiki.sabnzbd.org/user-pre-queue-script ... does that work for you, as in: the pre-queue script *forces* <50MB downloads to be downloaded
That worked wonderfully, thank you! Is their anyway to combine this with checking the priority of shows grabbed by sickbeard?

Thanks again!

Cheers,
~Spritz
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Pre_Process Script

Post by sander »

Spritzup wrote:
sander wrote:See the python script on http://wiki.sabnzbd.org/user-pre-queue-script ... does that work for you, as in: the pre-queue script *forces* <50MB downloads to be downloaded
That worked wonderfully, thank you! Is their anyway to combine this with checking the priority of shows grabbed by sickbeard?
... is that the same as 'The second part of the script would be to check for anything that has category "TV" and that is set to "High" and change it to "Force".'? If so, I think I can make it happen.
Spritzup
Newbie
Newbie
Posts: 6
Joined: March 18th, 2014, 6:28 pm

Re: Pre_Process Script

Post by Spritzup »

sander wrote:... is that the same as 'The second part of the script would be to check for anything that has category "TV" and that is set to "High" and change it to "Force".'? If so, I think I can make it happen.
That is exactly right. Thank you!

~Spritz
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Pre_Process Script

Post by sander »

This works with my simple testing:

Code: Select all

#!/usr/bin/env python
# See http://wiki.sabnzbd.org/user-pre-queue-script
# usage by SABnzbd:
# ./this-script.py 'The Playing Dead S01e01' '' '' '' '-100' '598510865' 'alt.binaries.boneless' 'The Playing Dead' '1' '1' ''

import sys

try:
	(scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
	downloadsize = int(downloadsize)
except:
	sys.exit(1)	# exit with 1 causes SABnzbd to ignore the output of this script

rcprio = -100	# Default
if (downloadsize < 50111222) or (category.lower()=="tv" and prio=="1") :
	rcprio = 2

print "1"	# Accept
print
print
print
print
print rcprio	
print

sys.exit(0)	# 0 means OK
Result:

Code: Select all

$ ./pre-queue-script.py 'The Playing Boy S01e01' '' 'TV' '' '1' '598510865' 'alt.binaries.boneless' 'The Playing Boy' '1' '1' ''
1




2


HTH
Spritzup
Newbie
Newbie
Posts: 6
Joined: March 18th, 2014, 6:28 pm

Re: Pre_Process Script

Post by Spritzup »

Sorry for the very late reply. I've had an interesting few weeks and this got back burnered. In any case, this script works awesome! Thank you so much, I really appreciate it :)

~Spritz
Post Reply