Pre Queue Script on Syno DS doesnt work...

Come up with a useful post-processing script? Share it here!
Post Reply
nextasy
Newbie
Newbie
Posts: 6
Joined: February 1st, 2012, 8:57 am

Pre Queue Script on Syno DS doesnt work...

Post by nextasy »

Hi,

i created a pre queue script on my Syno DS 209 and used this example ->http://forums.sabnzbd.org/viewtopic.php?t=6885 to change the category if some words are found in the nzb name

Unfortunatly it doesnt work for me :-(

- the pre queue script is choosen in Config -> Switches
- chmod 777 on the script was made

Sabnzb Log File shows this

Code: Select all

[newsunpack:1405] Running pre-queue script ['/volume1/Sabnzb/Scripts/pre-queue-script-test.sh', 'The.Thing.2011.German.AC3D.5.1.720p.BDRiP.XviD-icq4711', '', '', '', '-100', '2919867029', 'alt.binaries.ath alt.binaries.dc alt.binaries.mom alt.binaries.nzm', '', '', '', '']
This is my script

Code: Select all

    #!/bin/sh
    #
    # NZB set category Script by Mar2zz v0.1

    # input (this is what sabnzbd feeds to this script)
    # All parameters (except 1) can be empty, meaning a default value.
    # 1 : Name of the NZB (no path, no ".nzb")
    # 2 : PP (0, 1, 2 or 3)
    # 3 : Category
    # 4 : Script (no path)
    # 5 : Priority (-100, -1, 0 or 1 meaning Default, Low, Normal, High)
    # 6 : Size of the download (in bytes)
    # 7 : Group list (separated by spaces)
    # 8 : Show name
    # 9 : Season (1..99)
    # 10 : Episode (1..99)
    # 11: Episode name

    # outputparams (what this script tells sabnzbd)
    # The script writes the results to the console, each parameter on a separate line.
    # Each parameter (except 1) can be an empty line, meaning the original value.
    # 1 : 0=Refuse, 1=Accept
    # 2 : Name of the NZB (no path, no ".nzb")
    # 3 : PP (0, 1, 2 or 3)
    # 4 : Category
    # 5 : Script (basename)
    # 6 : Priority (-100 -2, -1, 0 or 1, meaning Default, Paused, Low, Normal, High )
    # 7 : Group to be used (in case your provider doesn't carry all groups and there are multiple groups in the NZB)

    ### if a word between *'s is found in the nab file name the category will be changed to the one that's set.
    
    case $1 in
	*BLUERAY*)
	   cat=film
	   ;;
	*h264*)
	   cat=filme
	   ;;
	*telesync*)
	   cat=filme
	   ;;
	*x264*)
	   cat=filme
	   ;;
	*XviD*)
	   cat=filme
	   ;;
	*XvID*)
	   cat=filme
	   ;;
	*1080p*)
	   cat=filme
	   ;;
	*DTS*)
	   cat=filme
	   ;;
	*DVD*)
	   cat=filme
	   ;;
       *)
          cat=$3
          ;;
    esac

### now tell sab what to do with nzb (note, this must be echoed in specific order, every command on a new line)
echo "1"    # tell sab to use this .nzb
echo $1    # keep original name for nzb
echo $2    # keep original pp
echo "$cat"    #set category to new if one of the parameters was found
I testet the script and it says:

Code: Select all

NAS> ./pre-queue-script-test.sh 'The.Thing.2011.German.AC3D.5.1.720p.BDRiP.XviD-icq4711', '', '', '', '-100', '2919867029', 'alt.binaries.ath alt.binaries.dc alt.binaries.mom alt
.binaries.nzm', '', '', '', ''
1
The.Thing.2011.German.AC3D.5.1.720p.BDRiP.XviD-icq4711,
,
filme
But when i looked in the sabnzb download site, the catorgy is still default. What ist wrong?
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Pre Queue Script on Syno DS doesnt work...

Post by jcfp »

nextasy wrote:But when i looked in the sabnzb download site, the catorgy is still default. What ist wrong?
Nothing is wrong, not changing the category is simply a possible outcome of the script you're using (last case is a catch-all that keeps the cat as is). The only mistake is the incorrect vars you're passing to the script when doing your test on the command line: those commas are only there to separate the arguments in sab's logs and therefore shouldn't be included when testing on the command line.
nextasy
Newbie
Newbie
Posts: 6
Joined: February 1st, 2012, 8:57 am

Re: Pre Queue Script on Syno DS doesnt work...

Post by nextasy »

Hi,

i deleted the catch all at the end, but the problem still persist

To test the script, i feed it again without the commas

Code: Select all

NAS> ./pre-queue-script.sh 'The.Thing.2011.German.AC3D.5.1.720p.BDRiP.XviD-icq4711' '' '' '' '-100' '2919867029' 'alt.binaries.ath alt.binaries.dc alt.binaries.mom alt.binaries.nzm' '' '' '' ''
1
The.Thing.2011.German.AC3D.5.1.720p.BDRiP.XviD-icq4711

filme
From my point of view, the script recognized the nzb and put it in the right category - but when the download starts, its still default category
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Pre Queue Script on Syno DS doesnt work...

Post by shypike »

Did you define a category "filme"?
nextasy
Newbie
Newbie
Posts: 6
Joined: February 1st, 2012, 8:57 am

Re: Pre Queue Script on Syno DS doesnt work...

Post by nextasy »

shypike wrote:Did you define a category "filme"?
Yes

http://imageshack.us/photo/my-images/69 ... 0201u.png/
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Pre Queue Script on Syno DS doesnt work...

Post by shypike »

Switch on "Debug" logging in the Status page
and check in the log file whether the script actually run and what is returned.
Also, which version do you use? Some of the older releases contain bugs in the pre-script handling.
nextasy
Newbie
Newbie
Posts: 6
Joined: February 1st, 2012, 8:57 am

Re: Pre Queue Script on Syno DS doesnt work...

Post by nextasy »

So...

The debug output shows this

Code: Select all

2012-02-01 20:52:52,446::INFO::[__init__:516] Backing up /volume1/Sabnzb/incomplete/The Thing German DL AC3 Dubbed 720p BluRay x264-VCF.3/__ADMIN__/The Thing German DL AC3 Dubbed 720p BluRay x264-VCF.nzb.gz
2012-02-01 20:52:53,749::INFO::[newsunpack:1405] Running pre-queue script ['/volume1/Sabnzb/Scripts/pre-queue-script-test.sh', 'The Thing German DL AC3 Dubbed 720p BluRay x264-VCF', '', '', '', '-100', '5609418687', 'alt.binaries.ath alt.binaries.hd.ger.moviez alt.binaries.hdtv.german alt.binaries.hdtv.x264 alt.binaries.u-4all', '', '', '', '']
2012-02-01 20:52:54,006::DEBUG::[newsunpack:1412] Failed script /volume1/Sabnzb/Scripts/pre-queue-script-test.sh, Traceback: 
Traceback (most recent call last):
  File "/usr/local/sabnzbd/share/SABnzbd/sabnzbd/newsunpack.py", line 1410, in pre_queue
    startupinfo=stup, env=env, creationflags=creationflags)
  File "/usr/local/python26/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/usr/local/python26/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error
2012-02-01 20:52:54,088::INFO::[nzbqueue:167] Saving queue

Seems that he find an error

Version is 0.6.14
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Pre Queue Script on Syno DS doesnt work...

Post by jcfp »

You don't have that weird spacing in the script you posted here in the real thing as well, do you? Almost every line starting with a bunch of spaces?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Pre Queue Script on Syno DS doesnt work...

Post by shypike »

Indeed, the first line of the script is wrong.
It must be:

Code: Select all

#!/bin/sh
without any leading spaces and obviously, /bin/sh should exist as an executable program.
nextasy
Newbie
Newbie
Posts: 6
Joined: February 1st, 2012, 8:57 am

Re: Pre Queue Script on Syno DS doesnt work...

Post by nextasy »

Thank you - now it worked for me
Post Reply