Page 1 of 1

iPhone notification via Prowl

Posted: July 21st, 2009, 11:54 am
by UloPe
Hi,

i made a quick script to notify me about finished downloads on my iPhone via Prowl:
You need the prowlpy library (there is a link on the Prowl site).

Code: Select all

#!/usr/bin/env python

import sys

from prowlpy import Prowl

p = Prowl('YOUR_API_KEY_GOES_HERE')
try:
    p.add("SABnzbd", "Download finished", '"%s" completed' % sys.argv[3])
except Exception, e:
    print e

Re: iPhone notification via Prowl

Posted: July 23rd, 2009, 11:20 am
by jubei
I can't get this to work, can you tell me exactly what pre-req's are required and where they need to be put?

Re: iPhone notification via Prowl

Posted: July 23rd, 2009, 12:04 pm
by UloPe
Hi,

you need prowlpy.py which in turn needs httplib2.

Install httplib2 as described on the page. Then put prowlpy.py in the same directory as my script and you should be up and running.

Of course you also need a prowl account.

Re: iPhone notification via Prowl

Posted: July 25th, 2009, 12:22 pm
by gazzzmoly
jubei wrote: I can't get this to work, can you tell me exactly what pre-req's are required and where they need to be put?

are you using an alpha  ?      if so post in the testers forum    not sure i can help in here !

Re: iPhone notification via Prowl

Posted: August 16th, 2009, 4:18 pm
by dasme
Hey there, I'm having an issue with this script. SABnzbd reports this output in the post-processing script when run:

Code: Select all

    Traceback (most recent call last):
  File "/Users/dasme/downloads/scripts/Prowl.py", line 5, in <module>
    from prowlpy import Prowl
  File "/Users/dasme/Downloads/scripts/prowlpy.py", line 12, in <module>
    import httplib2
ImportError: No module named httplib2
yet if I run the script manually (eg ./Prowl.py 1 2 3)I get a Prowl notification ("3" completed), so I know that httplib2 is installed and working. I'm new to Python, not having used it before so I'm wondering if this is a simple fix? I'm on OSX btw

thanks in advance for any tips!

Re: iPhone notification via Prowl

Posted: September 27th, 2009, 7:02 am
by Fevida
Works brilliantly on my FreeBSD-box!! Thnx!  ;D

Re: iPhone notification via Prowl

Posted: October 14th, 2009, 11:53 pm
by tastynzb
dasme,

I had the same error. To fix, install from the repo instead of installing manually

sudo apt-get install python-httplib2

Re: iPhone notification via Prowl

Posted: July 29th, 2011, 9:12 am
by Se7en
Hi all.

I'd like to have Prowl notifications from sabnzbd only if the download is incomplete/error message - if that's possible. If anyone has a script, I'd be more than happy :)

Re: iPhone notification via Prowl

Posted: November 4th, 2011, 3:08 pm
by idmanager
add your prowl api key and save script as .py file and set as default script to run on sab
will notify you on complete downloads

Code: Select all

#!/usr/bin/env python
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 = "enter the prowl api key here "
# 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=" + job_title + "&description=" + job_name)

Re: iPhone notification via Prowl

Posted: November 4th, 2011, 9:29 pm
by Se7en
idmanager wrote:add your prowl api key and save script as .py file and set as default script to run on sab
will notify you on complete downloads

Code: Select all

#!/usr/bin/env python
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 = "enter the prowl api key here "
# 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=" + job_title + "&description=" + job_name)
Nice, thanks, changed to Download%20Incomplete, it works like a charm. Thanks again O0

Re: iPhone notification via Prowl

Posted: November 29th, 2011, 4:03 pm
by Nurfballs
I cant seem to get this to work :(
I'm using the same script as Se7en, however the script executes but fails with the following error:

Code: Select all

env: python
: No such file or directory
Any help would be greatly appreciated.

Re: iPhone notification via Prowl

Posted: November 29th, 2011, 7:03 pm
by Nurfballs
Looks like i've fixed it by accident.

Originally, I created the script on my Windows machine, and used WinSCP to copy it to my linux box.
After making any changes to the script while troubleshooting, I would use the same method of editing it on my Windows machine and copying it back. Each time the script would fail with the same issue.

However, I found that if I edited the script using WinSCP directly on the linux box (instead of Notepad, and copying it back) - it seems to work. Code is exactly the same. Bizarre!

Re: iPhone notification via Prowl

Posted: November 30th, 2011, 11:40 am
by shypike
The bash shell gets confused when it reads a Windows text file,
because lines are terminated by a CR and an LF code (where Unix only uses LF).
The CR character is taken as part of the first line, so the "env" command looks for "python$",
where $ is the CR character.
The Python interpreter just ignores the extra characters.

Re: iPhone notification via Prowl

Posted: November 30th, 2011, 4:31 pm
by Nurfballs
Very interesting to know - thanks shypike!

Re: iPhone notification via Prowl

Posted: January 29th, 2013, 2:22 pm
by xreyuk
Sorry to bump the old thread, but to make idmanagers script work, do I still need the prowl.py file and httplib2?