[pp-script] prowl.py (iOS push notification service)

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
Post Reply
scottjl
Posts: 5
Joined: 15 May 2014, 19:09

[pp-script] prowl.py (iOS push notification service)

Post by scottjl » 15 May 2014, 19:17

Hello,

New convert from sabnzbd over to nzbget. Previously I had Prowl iOS push notification service support with a simple python script I found somewhere. Had to re-write the script a bit to get it to work with NZBget. Just the basics and certainly open to improvement, but this gets the job done.

You need a prowl account and an API key, save this script as prowl.py in your ppscript directory, enable it, configure in settings, enjoy!

Code: Select all

#!/usr/bin/env python
#
# Send a notification through prowlapp.com
#

##############################################################################
### NZBGET POST-PROCESSING SCRIPT                                          ###

# Send a prowl notification.
#
# Send a notification through prowlapp.com. You must have an account and
# and an API key set up.
# See http://prowl.weks.net/api.php for API details.
#
#
# NOTE: This script requires Python to be installed on your system.

##############################################################################
### OPTIONS                                                                ###

# Prowl API key to use.
#API=your-api-key-goes-here!

# Prowl notification priority: -2 (very low), -1, 0 (normal), 1, 2 (emergency)
#Priority=0

# Event title
#EventTitle=Download Complete

### NZBGET POST-PROCESSING SCRIPT
##############################################################################

import os,datetime,sys,urllib

event_name = os.environ['NZBPP_NZBNAME']
API = os.environ['NZBPO_API']
priority = os.environ['NZBPO_PRIORITY']
event_title = os.environ['NZBPO_EVENTTITLE']

# Exit codes used by NZBGet
POSTPROCESS_SUCCESS=93
POSTPROCESS_ERROR=94

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

# URL encode chars from NZB name that cause issues
event_time=event_time.replace(' ', '%20')
event_title=event_title.replace(' ', '%20')
event_name=event_name.replace(' ', '%20')
event_name=event_name.replace('_', '%5F')
event_name=event_name.replace('.', '%2E')

urllib.urlopen("https://prowl.weks.net/publicapi/add?apikey=" + API + "&priority=" + priority + "&application=nzbget&event=" + event_title + "&description=" + event_name + "%20%40%20" + event_time)

sys.exit(POSTPROCESS_SUCCESS)

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests