Page 1 of 3

iPhone notification via Prowl [Windows script]

Posted: July 25th, 2009, 6:26 pm
by relman
Hi Everyone,

Firstly thanks to the poster for the iPhone notification via Prowl post. When I saw this I did some google searches and found out what a great idea this was. So as I run SABnzbd on a Win32 box and really have no idea about python I decided to write a CMD and VBS file to do the job, so far all works great and now all my download notifications are getting pushed to my phone. 

Before you install the script make sure you get the Prowl app for the iphone. £1.79 in the UK

There are 2 parts. firstly the CMD (batch file) which is used by windows sabnzbd this basically takes the info from sabnzbd and makes the vbscript file run. The second part is the vbscript.

Part 1.

Below is the CMD file, copy the file and paste into notepad and save as prowl.cmd . Make sure you change to your prowl API key. and make sure the location set for the prowl.vbs file is correct.

Code: Select all

set API="<Put API Key here>"

Set Item=%3
setlocal enableextensions
set var_=%Item%
set var_=%var_:=†%
set var_=%var_:Ž=„%
set var_=%var_:™=”%
set var_=%var_:"=%
set var_=%var_:!=%
set var_=%var_:_= %
set var_=%var_:;= %
set var_=%var_::= %
set var_=%var_:'= %
set var_=%var_:,= %
endlocal & set ItemConvert=%var_%
Set ItemConvert= "%ItemConvert%"
set priority=2
set desc=%ItemConvert%

cscript C:\downloads\temp\scripts\prowl.vbs %API% %priority% %desc%
Part 2.

Below is the VBScript. Copy and paste this into notepad and save as prowl.vbs and place in script folder with above CMD file.

Code: Select all

API = WScript.Arguments.Item(0)
priority = WScript.Arguments.Item(1)
desc = WScript.Arguments.Item(2)

set oHTTP = CreateObject("Microsoft.XMLHTTP")  
oHTTP.open "Get", "https://prowl.weks.net/publicapi/add?" & "apikey=" & API & "&priority=" & priority & "&application=SABnzbd&event=" & Date() & " " & Time()  & "&description=" & desc ,false  
oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"  
oHTTP.send  
HTTPPost = oHTTP.responseText
Now just set prowl.cmd as your default script. Everytime something downloads you will get a push message on your iphone.

To Recap

1. Create a Prowl account
2. Paste the Key into the cmd file
3. Change the path to the VBS file in the cmd file
4. Buy and install the iPhone app
5. Log in to my Prowl account through the iPhone app
6. Add the cmd file as the default script.

When editing the CMD file to add the location of the Prowl.Vbs file you will need to be careful if using a location with spaces. i.e. c:\documents and settings\.

Either enter old dos format e.g. C:\Docume~1\  or make sure the command is within speech marks.  Below are some examples using my documents as the folder with the scripts.  (C:\documents and settings\Admin\My Documents\)

cscript C:\docume~1\Admin\Mydocu~1\prowl.vbs %API% %priority% %desc%

or

cscript "C:\documents and settings\Admin\My Documents\prowl.vbs" %API% %priority% %desc%

thanks bas & vdown for feedback.

Re: iPhone notification via Prowl [Windows script]

Posted: July 29th, 2009, 4:01 am
by bas
He Man i installed everything correctly. But it does not work with me  :-\

Added my api key from the prowl website (via settings) and added the path to the .vcb and set the default script in sabnzbd to this folder...restarted everything. But no push on my iphone

Re: iPhone notification via Prowl [Windows script]

Posted: July 29th, 2009, 6:08 am
by vdown
That's awesome, works great. Took about 2 mins to configure.

BTW you do need the Growl iPhone app for this to work (it's £1.79 in the UK)

Re: iPhone notification via Prowl [Windows script]

Posted: July 29th, 2009, 7:04 am
by bas
damn weird,  :(...did you change any settings to the growl windows program?

Re: iPhone notification via Prowl [Windows script]

Posted: July 29th, 2009, 8:44 am
by vdown
You don't need the Windows program installed. The script sends the notification with all the info directly to the Prowl servers.

All I did was:-

1. Create a Prowl account
2. Paste the Key into the cmd file
3. Change the path to the VBS file in the cmd file
4. Buy and install the iPhone app
5. Log in to my Prowl account through the iPhone app
6. Add the cmd file as the default script.

Re: iPhone notification via Prowl [Windows script]

Posted: July 29th, 2009, 4:05 pm
by bas
Yes! I find it out, the script or the code-language cant read spaces in the path... so C:/documents and settings... wil be red as C:/documents.

So i got it! Thnx dude

Re: iPhone notification via Prowl [Windows script]

Posted: August 17th, 2009, 4:30 pm
by relman
just a quick note. If you have upgraded Prowl and want to use the "quiet hours" option you might want to change the following setting in the cmd file.

set priority=2


change it to something like

set priority=0

2 means emergancy which overrides the quiet hours setting, if you set it to that is.

thanks

Re: iPhone notification via Prowl [Windows script]

Posted: October 3rd, 2009, 4:16 am
by TheMedic
Just registered to say a big thankyou for this - it worked first time and will come in very useful for keeping on top of SABnzbd+ whilst away from the PC!

Re: iPhone notification via Prowl [Windows script]

Posted: October 28th, 2009, 7:55 pm
by JohnSCS
Python script alternative.

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 = "<prowl api-key>"
# 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 [Windows script]

Posted: December 11th, 2009, 11:51 pm
by deedwar
thanks for the script it works perfectly

Re: iPhone notification via Prowl [Windows script]

Posted: October 4th, 2010, 12:07 pm
by mailgoe
followed all the steps but got an error in sabnzbd:

webinterface:
Image
"Exit(1) konnte nicht gefunden werden. Mehr." means something like "Exit(1) could not be found. More."

And after a click on the link "more" i will get this:

"C:\Programme\XUL\SABnzbd>~s
Der Befehl "~s" ist entweder falsch geschrieben oder
konnte nicht gefunden werden."

means:
"C:\Program Files\XUL\SABnzbd>~s
The command "~s" is either misspelled or
could not be found."

Whats wrong with that?

EDIT: Forgot to say that I'm not working with the newest SabNZBd version, hence that's not possible for me. I'm using the WHS Add-In for SabNZBd, and that's based on SabNZBd Version 0.5.3.

Re: iPhone notification via Prowl [Windows script]

Posted: October 17th, 2010, 3:38 pm
by relman
can you paste the contents of the .cmd file please.

Re: iPhone notification via Prowl [Windows script]

Posted: October 17th, 2010, 3:51 pm
by mailgoe

Code: Select all

set API="79c7bb8e283752fbc0f4b5b0fceXXXXXX"

Set Item=%3
setlocal enableextensions
set var_=%Item%
set var_=%var_:�=†%
set var_=%var_:Ž=„%
set var_=%var_:™=”%
set var_=%var_:"=%
set var_=%var_:!=%
set var_=%var_:_= %
set var_=%var_:;= %
set var_=%var_::= %
set var_=%var_:'= %
set var_=%var_:,= %
endlocal & set ItemConvert=%var_%
Set ItemConvert= "%ItemConvert%"
set priority=2
set desc=%ItemConvert%

cscript E:\usenet\scripts\prowl.vbs %API% %priority% %desc%
content of *.cmd file. Edited the api for known reasons :P
even if it#s workin now for me (with an alternative phyton script) i would like to detect the error.

Re: iPhone notification via Prowl [Windows script]

Posted: December 12th, 2010, 3:55 am
by simonk83
mailgoe wrote: followed all the steps but got an error in sabnzbd:

webinterface:
Image
"Exit(1) konnte nicht gefunden werden. Mehr." means something like "Exit(1) could not be found. More."

And after a click on the link "more" i will get this:

"C:\Programme\XUL\SABnzbd>~s
Der Befehl "~s" ist entweder falsch geschrieben oder
konnte nicht gefunden werden."

means:
"C:\Program Files\XUL\SABnzbd>~s
The command "~s" is either misspelled or
could not be found."

Whats wrong with that?

EDIT: Forgot to say that I'm not working with the newest SabNZBd version, hence that's not possible for me. I'm using the WHS Add-In for SabNZBd, and that's based on SabNZBd Version 0.5.3.
I get this same error unfortunately...

C:\Program Files (x86)\SABnzbd>~s
'~s' is not recognized as an internal or external command,
operable program or batch file.

Any ideas?

Re: iPhone notification via Prowl [Windows script]

Posted: December 13th, 2010, 4:54 am
by simonk83
simonk83 wrote:

C:\Program Files (x86)\SABnzbd>~s
'~s' is not recognized as an internal or external command,
operable program or batch file.
Anyone? :)