[Python] Post-Processing Script will never end

Come up with a useful post-processing script? Share it here!

[Python] Post-Processing Script will never end

Postby av_jui » April 20th, 2012, 3:41 pm

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
article=RqLmHxZWaCf1YaicoQa31@JBinUp.local, bytes=398524, partnum=1, art_id=None>
2012-04-20 20:22:36,424::DEBUG::[decoder:92] Decoding <Article: article=UgM72AiFTprkuVvH1mgE@JBinUp.local, bytes=398688, partnum=1, art_id=None>
2012-04-20 20:22:36,497::DEBUG::[decoder:92] Decoding <Article: article=kZPLO11BVJWPXeEnJBU1@JBinUp.local, bytes=398612, partnum=1, art_id=None>
2012-04-20 20:22:37,125::DEBUG::[decoder:92] Decoding <Article: article=eWqiffGvFYbKqVSAcHWE@JBinUp.local, bytes=398699, partnum=7, art_id=None>
2012-04-20 20:22:37,149::DEBUG::[decoder:92] Decoding <Article: article=nAwxzSF1aHqymbDS3Wr1@JBinUp.local, bytes=398765, partnum=8, art_id=None>
2012-04-20 20:22:37,210::DEBUG::[decoder:92] Decoding <Article: article=5JT7j1CjLb1hrXMkz7e7@JBinUp.local, bytes=398563, partnum=6, art_id=None>
2012-04-20 20:22:37,248::DEBUG::[decoder:92] Decoding <Article: article=1L9A2i6qTtlddrF0ISr9@JBinUp.local, bytes=398785, partnum=9, art_id=None>
2012-04-20 20:22:37,330::DEBUG::[decoder:92] Decoding <Article: article=YknZaMcKFnHOJojtKUcA@JBinUp.local, bytes=398858, partnum=5, art_id=None>
2012-04-20 20:22:37,410::DEBUG::[decoder:92] Decoding <Article: article=T403HsQBbSC9MFIBELZ1@JBinUp.local, bytes=398669, partnum=4, art_id=None>
2012-04-20 20:22:37,437::DEBUG::[decoder:92] Decoding <Article: article=Qn7hp3OlID8305GX2Pt@JBinUp.local, bytes=398669, partnum=3, art_id=None>
2012-04-20 20:22:37,460::DEBUG::[decoder:92] Decoding <Article: article=kKfyp60YnCkVgKAIhinE@JBinUp.local, 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
av_jui
Newbie
Newbie
 
Posts: 20
Joined: April 20th, 2012, 3:15 pm

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

Postby sander » April 20th, 2012, 4:35 pm

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: 3512
Joined: January 22nd, 2008, 3:22 pm

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

Postby sander » April 20th, 2012, 4:53 pm

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
sander
Release Testers
Release Testers
 
Posts: 3512
Joined: January 22nd, 2008, 3:22 pm

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

Postby shypike » April 21st, 2012, 3:21 am

Av_jui


What's your script trying to accomplish?
User avatar
shypike
Administrator
Administrator
 
Posts: 16568
Joined: January 18th, 2008, 1:49 pm

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

Postby av_jui » April 21st, 2012, 4:39 am

Hi

The Problem was not the script the Problem was the api of the application. Thanks for Help.
@shypike
Have a look at there viewtopic.php?f=6&t=9672&start=15#p64322
av_jui
Newbie
Newbie
 
Posts: 20
Joined: April 20th, 2012, 3:15 pm


Return to Post-Processing Scripts