Page 1 of 2
Pre processing trouble
Posted: August 9th, 2012, 6:24 am
by jowi
I'm experimenting with the pre-processing / pre-queue scripting, according to
http://wiki.sabnzbd.org/user-pre-queue-script.
I've create a simple python script, just for testing purposes, the only thing it does is return '0' indicating sabnzbd should REFUSE the nzb.
I can see in sabnzbd's logging that it is actually called, and says it accepts the nzb, i dont know why, since i return 0 as in REFUSED?
Code: Select all
2012-08-10 14:59:15,592::INFO::[newsunpack:1417] Running pre-queue script ['/mnt/cache/Apps/sabnzbd/scripts/pre.py', 'Breaking.Bad.S05E02.Madrigal.HDTV.x264-FQM', '', 'tvseries', '', '-100', '330523175', 'alt.binaries.multimedia alt.binaries.teevee', '', '', '', '']
2012-08-10 14:59:15,595::INFO::[newsunpack:1439] Pre-Q accepts Breaking.Bad.S05E02.Madrigal.HDTV.x264-FQM
the script itself:
Code: Select all
#!/usr/bin/env python
import os
import sys
print "0"
sys.exit(0)
What am i missing here?
Re: Pre processing trouble
Posted: August 9th, 2012, 8:02 am
by shypike
Does the script run from the command line?
If SABnzbd detects any problems it will accept the NZB anyway.
Set logging to "Debug" in order to get more info logged.
Re: Pre processing trouble
Posted: August 9th, 2012, 9:08 am
by jowi
Yes, it runs from the command line. Debug logging is on, the logging in the first post is with debug logging.
I've also tried to let the script create a file on startup, just as 'proof' it has been executed. From the command line it works, from within sabnzb, it does not, even though the logging keeps showing the script has been executed.
I've also tried returning the extra 6 empty lines, so it totals the 7 lines. Did not help:
Code: Select all
#!/usr/bin/env python
import os
import sys
print "0"
print
print
print
print
print
print
sys.exit(0)
Re: Pre processing trouble
Posted: August 9th, 2012, 9:41 am
by shypike
Do you see "Pre-Q refuses
name" or "Pre-Q accepts
name" in the log?
To exclude Python problems, try something simpler first:
Re: Pre processing trouble
Posted: August 9th, 2012, 9:46 am
by jowi
As you can see in the logging in the first post, sab says 'Pre-Q accepts <file>'...
The python enviroment works, i've build an extensive postprocessing using python, which is working nicely with sab & sickbeard.
How do i use your (bash?) sample? Does it needs some special extension, because i can only select .py files in sabnzb's pre-queue dropdown box...
*edit* nevermind, got it, had to chmod it a bit

now it shows up in the dropdown.
Re: Pre processing trouble
Posted: August 9th, 2012, 9:54 am
by shypike
The essential bit is that you've done a "chmod +x" on your script.
No extension needed, any name will do.
Reviewing the code, I see a missed opportunity for better logging...
That's Murphy for you: the app is littered with logging, except in that one place
where you happen to need it

Re: Pre processing trouble
Posted: August 9th, 2012, 9:59 am
by jowi
I tested the bash thingy, this time it crashes:
Code: Select all
2012-08-10 16:57:30,106::INFO::[newsunpack:1417] Running pre-queue script ['/mnt/cache/Apps/sabnzbd/scripts/pre2.sh', 'Breaking.Bad.S05E02.Madrigal.HDTV.x264-FQM', '', 'tvseries', '', '-100', '330523175', 'alt.binaries.multimedia alt.binaries.teevee', '', '', '', '']
2012-08-10 16:57:30,109::DEBUG::[newsunpack:1424] Failed script /mnt/cache/Apps/sabnzbd/scripts/pre2.sh, Traceback:
Traceback (most recent call last):
File "/mnt/cache/Apps/sabnzbd/sabnzbd/newsunpack.py", line 1422, in pre_queue
startupinfo=stup, env=env, creationflags=creationflags)
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Re: Pre processing trouble
Posted: August 9th, 2012, 1:14 pm
by shypike
That may mean that the path /bin/sh is not correct.
Check what it is on your system.
Re: Pre processing trouble
Posted: August 9th, 2012, 1:24 pm
by jowi
Will try to. I'm new at linux.
But the bash script does run from the command line...
*edit*
Code: Select all
root@Tower:/bin# ls -l sh
lrwxrwxrwx 1 root root 4 2012-06-21 00:54 sh -> bash
looks ok to me?
Re: Pre processing trouble
Posted: August 9th, 2012, 3:48 pm
by shypike
It runs from the command prompt too?
Re: Pre processing trouble
Posted: August 9th, 2012, 4:46 pm
by jowi
Yes it does.
Re: Pre processing trouble
Posted: August 10th, 2012, 3:32 pm
by jowi
Anyone who knows what i'm doing wrong here?
Any tips or ideas? I'm running Sab 0.7.2 on an unRAID v5.0 server.
Re: Pre processing trouble
Posted: August 10th, 2012, 4:15 pm
by NoTolerance
Carriage returns maybe?
Run 'cat -vE pre.py' and look for '\r' in the output.
Re: Pre processing trouble
Posted: August 10th, 2012, 4:21 pm
by shypike
Checked again on two Linux platforms: no issues.
It might be something in the Python implementation.
BTW: do you also use post-processing scripts and do they work?
Re: Pre processing trouble
Posted: August 10th, 2012, 4:49 pm
by jowi
NoTolerance wrote:Carriage returns maybe?
Run 'cat -vE pre.py' and look for '\r' in the output.
Nope...
Code: Select all
#!/usr/bin/env python^M$
import sys^M$
print "0"^M$
exit(0)^M$
shypike wrote:BTW: do you also use post-processing scripts and do they work?
Yep... wrote them myself as well.