post processing on Linux with python script

Come up with a useful post-processing script? Share it here!
Post Reply
landski
Newbie
Newbie
Posts: 17
Joined: January 12th, 2010, 7:12 am

post processing on Linux with python script

Post by landski »

This python Prowl script I found on this forum.

Code: Select all

import sys,urllib

# Get clean NZB name
job_name = sys.argv[3]

# Prowl API settings - http://prowl.weks.net/api.php
# Set Prowl API
API = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Set Prowl priority. 0 - Normal, 2 - Emergency, -2 - Very Low
priority = "0"

# Set job title/event name
job_title = "Download%20Complete"

# Get current date/time and strip spaces
from time import gmtime, strftime
event_time = strftime("%d/%m/%y %H:%M")
event_time=event_time.replace(' ', '%20')

# URL encode chars from NZB name that cause issues
job_name=job_name.replace(' ', '%20')
job_name=job_name.replace('_', '%20')
job_name=job_name.replace('.', '%20')

# Send download complete notification to iPhone - swap 'job_title' for 'event_time' if completion time is required instead of 'Download Complete'
urllib.urlopen("https://prowl.weks.net/publicapi/add?apikey=" + API + "&priority=" + priority + "&application=SABnzbd&event=" + event_time + "&description=" + job_name)
I named it Prowl.py, and it runs fine under OSX, but when I try to run it as a post-processing script in Linux (actually on a QNAP TS-509) I get the error:
Exit(-1) Cannot run script
I have placed the script in accessible shares, and through a Web File Manager changed the file permissions for Prowl.py to 777, but to no avail.

Any suggestions for a linux noob?
konti
Newbie
Newbie
Posts: 5
Joined: December 14th, 2009, 4:32 am

Re: post processing on Linux with python script

Post by konti »

Try starting your script with: #! /usr/bin/python
landski
Newbie
Newbie
Posts: 17
Joined: January 12th, 2010, 7:12 am

Re: post processing on Linux with python script

Post by landski »

Yep, that did the trick.

Thanks  ;D
drewdatrip
Release Testers
Release Testers
Posts: 25
Joined: May 15th, 2010, 6:20 pm

Re: post processing on Linux with python script

Post by drewdatrip »

what are the pre-req installs for this to work on your QNAP?

Drew
Post Reply