[Python] Post-Processing Script will never end

Come up with a useful post-processing script? Share it here!
Post Reply
av_jui
Newbie
Newbie
Posts: 20
Joined: April 20th, 2012, 2:15 pm

[Python] Post-Processing Script will never end

Post by av_jui »

Hallo

I have a Problem with the following script

Code: Select all

#!/usr/bin/env python
import sys
import urllib
filePath = str(sys.argv[1])
fields = str(sys.argv[3]).split("-")
gamezID = fields[0].replace("[","").replace("]","").replace(" ","")
status = str(sys.argv[7])
downloadStatus = 'Wanted'
if(status == '0'):
    downloadStatus = 'Downloaded'
url = "http://192.***.***.***:****/api?api_key=***************************&mode=UPDATEREQUESTEDSTATUS&db_id=" + gamezID + "&status=" + downloadStatus
responseObject = urllib.FancyURLopener({}).open(url)
responseObject.read()
responseObject.close()
print("Processing Completed Successfully")
Sabnzb will never stop the script.
Here is the Log

Code: Select all

[email protected], bytes=398524, partnum=1, art_id=None>
2012-04-20 20:22:36,424::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398688, partnum=1, art_id=None>
2012-04-20 20:22:36,497::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398612, partnum=1, art_id=None>
2012-04-20 20:22:37,125::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398699, partnum=7, art_id=None>
2012-04-20 20:22:37,149::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398765, partnum=8, art_id=None>
2012-04-20 20:22:37,210::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398563, partnum=6, art_id=None>
2012-04-20 20:22:37,248::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398785, partnum=9, art_id=None>
2012-04-20 20:22:37,330::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398858, partnum=5, art_id=None>
2012-04-20 20:22:37,410::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398669, partnum=4, art_id=None>
2012-04-20 20:22:37,437::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398669, partnum=3, art_id=None>
2012-04-20 20:22:37,460::DEBUG::[decoder:92] Decoding <Article: [email protected], bytes=398696, partnum=2, art_id=None>
2012-04-20 20:22:37,714::INFO::[newsunpack:658] 4 Datei(en)/Ordner entpackt in 1 second
2012-04-20 20:22:37,715::DEBUG::[newsunpack:421] rar_unpack(): Rars: ['/mnt/Media/temp/[5] - Street Fighter X Tekken.4/pdx-sftj.001', '/mnt/Media/temp/[5] - Street Fighter X Tekken.4/pdx-sftj.002']
2012-04-20 20:22:37,716::DEBUG::[newsunpack:422] rar_unpack(): Newfiles: ['/mnt/Media/Share/ps3/[5] - Street Fighter X Tekken.7/PS3_GAME', '/mnt/Media/Share/ps3/[5] - Street Fighter X Tekken.7/PS3_GAME/USRDIR', 'PS3_GAME/USRDIR/EBOOT.BIN', '/mnt/Media/Share/ps3/[5] - Street Fighter X Tekken.7/PS3_GAME/PARAM.SFO']
2012-04-20 20:22:37,716::INFO::[newsunpack:428] Deleting /mnt/Media/temp/[5] - Street Fighter X Tekken.4/pdx-sftj.001
2012-04-20 20:22:37,728::INFO::[newsunpack:428] Deleting /mnt/Media/temp/[5] - Street Fighter X Tekken.4/pdx-sftj.002
2012-04-20 20:22:37,733::INFO::[newsunpack:201] Unrar finished on /mnt/Media/temp/[5] - Street Fighter X Tekken.4
2012-04-20 20:22:37,735::DEBUG::[newsunpack:1238] build_filelists(): joinables: []
2012-04-20 20:22:37,735::DEBUG::[newsunpack:1239] build_filelists(): zips: []
2012-04-20 20:22:37,736::DEBUG::[newsunpack:1240] build_filelists(): rars: []
2012-04-20 20:22:37,737::DEBUG::[newsunpack:1241] build_filelists(): ts: []
2012-04-20 20:22:37,738::INFO::[postproc:319] unpack_magic finished on [5] - Street Fighter X Tekken
2012-04-20 20:22:37,739::DEBUG::[misc:736] Moving. Old path:/mnt/Media/temp/[5] - Street Fighter X Tekken.4/pdx-sftj.nfo new path:/mnt/Media/Share/ps3/[5] - Street Fighter X Tekken.7/pdx-sftj.nfo unique?:False
2012-04-20 20:22:37,740::DEBUG::[misc:736] Moving. Old path:/mnt/Media/temp/[5] - Street Fighter X Tekken.4/pdx-sftj.sfv new path:/mnt/Media/Share/ps3/[5] - Street Fighter X Tekken.7/pdx-sftj.sfv unique?:False
2012-04-20 20:22:37,746::INFO::[newsunpack:133] Running external script /mnt/Media/Downloads/SIckbeard-Stable-489/gamezPostProcess.py(/mnt/Media/Share/ps3/[5] - Street Fighter X Tekken.7, Street Fighter X Tekken JAP EBOOT PATCH TB PS3-PARADOX.nzb, [5] - Street Fighter X Tekken, , ps3,alt.binaries.console.ps3, 0) 
When I type the line into the Browser ther are no problems

Code: Select all

http://192.***.***.***:****/api?api_key=***************************&mode=UPDATEREQUESTEDSTATUS&db_id=5&status=Wanted
Please can anyone help me?
Thanks
User avatar
sander
Release Testers
Release Testers
Posts: 9070
Joined: January 22nd, 2008, 2:22 pm

Re: [Python] Post-Processing Script will never end

Post by sander »

I would start with a mini pyhon script that works; just a one liner. According to http://wiki.sabnzbd.org/user-scripts

"The "return" code that your script itself returns should be 0 if all went well or non-zero if errors occurred. If the return code is something else than 0, SABnzbd's History will show that return code (also known as exit code) in green surrounded by "Exit(…)"."

So a python script with just one line with that exit(). Make sure that works. Then add extra lines and test it.
User avatar
sander
Release Testers
Release Testers
Posts: 9070
Joined: January 22nd, 2008, 2:22 pm

Re: [Python] Post-Processing Script will never end

Post by sander »

This is the python-dummy.py script:

Code: Select all

#!/usr/bin/python
print "Yes, this is it"
exit(0)
The result in sabnzbd.log:

Code: Select all

2012-04-20 22:49:45,530::INFO::[postproc:273] Starting PostProcessing on virus => Repair:True, Unpack:True, Delete:True, Script:python-dummy.py, Cat:*
2012-04-20 22:49:46,185::INFO::[newsunpack:136] Running external script /home/sander/scripts-voor-SAB/python-dummy.py(/home/sander/Downloads/SABdownloads/virus.2, virus.nzb, virus, , *, alt.binaries.boneless, 0)
and the text "Yes, this is it" is printed in green in the History overview.

Can you start with that?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: [Python] Post-Processing Script will never end

Post by shypike »

Av_jui
What's your script trying to accomplish?
av_jui
Newbie
Newbie
Posts: 20
Joined: April 20th, 2012, 2:15 pm

Re: [Python] Post-Processing Script will never end

Post by av_jui »

Hi

The Problem was not the script the Problem was the api of the application. Thanks for Help.
@shypike
Have a look at there http://forums.sabnzbd.org/viewtopic.php ... =15#p64322
Post Reply