Skip to content

Push Notifications to a large number of supported services. It can be easily integrated into NZBGet and SABnzbd too.

License

Notifications You must be signed in to change notification settings

athen66/nzb-notify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: This script was originally written to be an NZBGet post-processing script notifying you of retrieved content through a variety of different notification services. But will work for SABnzbd users (starting at v1.1.0+) as well. The script additionally works fine as standalone tool for anyone else too! See the Command Line section below for details how you can easily use this on it's own (without NZBGet).

SABnzbd users can reference sabnzbd-notify.py to gain support of the tool as well.

Notify Processing Script

Send notifications to all of the popular notification services (PushBullet, NotifyMyAndroid, XBMC, Email etc). NZBGet (and/or SABnzbd) will automatically notify you of anything it downloads. You can chain as many notification services as you want and support most of the advance features each service offers you too.

You can even run the tool from the command line for your own custom use. Notify.py was written in such a way that there wouldn't be a lot of effort to add more notification services either. Feel free to contact me if one you would like to use is missing.

Installation Instructions

  1. Ensure you have at least Python v2.6 or higher installed onto your system.
  2. Simply place the Notify.py and Notify directory together.
    • NZBGet users: you'll want to place these inside of your nzbget/scripts directory. Please ensure you are running (at least) NZBGet v11.0 or higher. You can acquire the latest version of of it from here.
    • NZBGet users: As one additional note; this script makes use of the RPC feature of NZBGet in order to retrive all of the status information it will notify you with. Its very important that this is configured correctly (in the 'Settings -> Security' area). The out of the box settings should work fine; but worth noting here should experience any issues.
    • SABnzbd users: You'll point your SABnzbd configuration to reference sabnzbd-notify.py via the Script entry and not Notify.py. However, please note that the Notify.py script is still required (as sabnzbd-notify.py is a wrapper to it). You will use the Parameters section to provide the services you wish to notify (see below how they are constructed).

The Non-NZBGet/SABnzbd users can also use this script from the command line. See the Command Line section below for more instructions on how to do this.

Note: The Notify directory provides all of the nessisary dependencies in order for this script to work correctly. The directory is only required if you do not have the packages already available to your global environment. These dependant packages are all identified under the Dependencies section below.

Supported Notify Services

The table below identifies the provider Notify.py supports and the location that content is retrieved from.

Notification Service Service ID Default Port Example Syntax
Boxcar boxcar:// (TCP) 443 boxcar://hostname
boxcar://hostname/@tag
boxcar://hostname/device_token
boxcar://hostname/device_token1/device_token2/device_tokenN
boxcar://hostname/alias
boxcar://hostname/@tag/@tag2/alias/device_token
Growl growl:// (UDP) 23053 growl://hostname
growl://hostname:portno
growl://password@hostname
growl://password@hostname:port
_Note: you can also use the get parameter version which can allow the growl request to behave using the older v1.x protocol. An example would look like: growl://hostname?version=1
Faast faast:// (TCP) 443 faast://authorizationtoken
JSON (Simple) json:// or jsons:// (TCP) 80 or 443 json://hostname
json://user@hostname
json://user:password@hostname:port
json://hostname/a/path/to/post/to
KODI kodi:// or kodis:// (TCP) 8080 or 443 kodi://hostname
kodi://user@hostname
kodi://user:password@hostname:port
Notify My Android nma:// (TCP) 443 nma://apikey
Prowl prowl:// (TCP) 443 prowl://apikey
prowl://apikey/providerkey
Join join:// (TCP) 443 join://apikey/device
join://apikey/device1/device2/deviceN/
join://apikey/group
join://apikey/groupA/groupB/groupN
join://apikey/DeviceA/groupA/groupN/DeviceN/
Pushalot palot:// (TCP) 443 palot://authorizationtoken
PushBullet pbul:// (TCP) 443 pbul://accesstoken
pbul://accesstoken/#channel
pbul://accesstoken/A_DEVICE_ID
pbul://accesstoken/email@address.com
pbul://accesstoken/#channel/#channel2/email@address.net/DEVICE
Pushover pover:// (TCP) 443 pover://user@token
pover://user@token/DEVICE
pover://user@token/DEVICE1/DEVICE2/DEVICEN
Note: you must specify both your user_id and token
Toasty toasty:// (TCP) 80 toasty://user@DEVICE
toasty://user@DEVICE1/DEVICE2/DEVICEN
Note: you must specify both your user_id and at least 1 device!
XBMC xbmc:// or xbmcs:// (TCP) 8080 or 443 xbmc://hostname
xbmc://user@hostname
xbmc://user:password@hostname:port
Slack slack:// (TCP) 443 slack://TokenA/TokenB/TokenC/Channel
slack://botname@TokenA/TokenB/TokenC/Channel
slack://user@TokenA/TokenB/TokenC/Channel1/Channel2/ChannelN
MatterMost mmost:// (TCP) 8065 mmost://hostname/authkey
mmost://hostname:80/authkey
mmost://user@hostname:80/authkey
mmost://hostname/authkey?channel=channel
mmosts://hostname/authkey
mmosts://user@hostname/authkey
Telegram tgram:// (TCP) 443 tgram://bottoken/ChatID
tgram://bottoken/ChatID1/ChatID2/ChatIDN
XML (Simple) xml:// or xmls:// (TCP) 80 or 443 xml://hostname
xml://user@hostname
xml://user:password@hostname:port
xml://hostname/a/path/to/post/to

It also just supports straight forward emailing too:

Service ID Default Port Example Syntax
mailto:// (TCP) 25 mailto://userid:pass@domain.com
mailto://domain.com?user=userid&pass=password
mailto://domain.com:2525?user=userid&pass=password
mailto://user@gmail.com&pass=password
mailto://userid:password@example.com?smtp=mail.example.com&from=noreply@example.com&name=no%20reply
mailtos:// (TCP) 587 mailtos://userid:pass@domain.com
mailtos://domain.com?user=userid&pass=password
mailtos://domain.com:465?user=userid&pass=password
mailtos://user@hotmail.com&pass=password
mailtos://userid:password@example.com?smtp=mail.example.com&from=noreply@example.com&name=no%20reply

Common supported services where the smtp port, server, userid structure, and security is already known are as follows:

  • Google - mailtos://userid:pass@gmail.com knows to use a secure connection (even if you specify mailto://) and to use the smtp server (mail.google.com) and appropriate secure port (587). It also automatically constructs your userid as being userid@gmail.com. Note: If you're using 2 way authentication, you'll need to generate an app password
  • Hotmail - mailtos://userid:pass@hotmail.com or mailtos://userid:pass@live.com knows to use a secure connection (even if you specify mailto://) and to use the smtp server smtp.live.com and appropriate secure port (465). It also automatically constructs your userid as being userid@live.com or userid@hotmail.com depending on what you identified.
  • Prontomail - mailtos://userid:pass@prontomail.com knows to use a secure connection (even if you specify mailto://) and to use the smtp server (secure.emailsrvr.com) and appropriate secure port (465). It also automatically constructs your userid as being userid@prontomail.com.
  • Yahoo - mailtos://userid:pass@yahoo.com knows to use a secure connection (even if you specify mailto://) and to use the smtp server smtp.live.com and appropriate secure port (587). It also automatically constructs your userid as being userid@yahoo.com or userid@yahoo.ca depending on what you identified.

To eliminate any confusion, any url parameter (key=value) specified will over-ride what was detected in the url; hence:

  • mailto://usera:pass123@domain.com?user=foobar@domain.com: the userid of foobar would over-ride the userid usera specified. However since the password was not over-ridden, the password of pass123 would be used still.

Dependencies

The following dependencies are already provided for you within the Notify directory and no further effort is required by you. However, it should be known that Notify.py depends on the following packages:

Name Version Source
backports-ssl_match_hostname 3.4.0.2 https://pypi.python.org/pypi/backports.ssl_match_hostname/3.4.0.2
chardet 2.2.1 https://pypi.python.org/pypi/chardet/2.2.1
importlib 1.0.1 https://pypi.python.org/pypi/importlib/1.0.1
*markdown 2.5.1 https://github.com/EnTeQuAk/Python-Markdown/tree/feature/py26
ndg-httpsclient 0.3.2 https://pypi.python.org/pypi/ndg-httpsclient/0.3.2
ordereddict 1.1 https://pypi.python.org/pypi/ordereddict/1.1
pynzbget 0.3.1 https://pypi.python.org/pypi/pynzbget/0.3.1
requests [P] 2.3.0 https://pypi.python.org/pypi/requests/2.3.0
six 1.6.1 https://pypi.python.org/pypi/six/1.6.1
pyasn1 0.1.7 https://pypi.python.org/pypi/pyasn1/0.1.7
pyOpenSSL [P] 16.2.0 https://pypi.python.org/pypi/pyOpenSSL/16.2.0
gntp 1.0.2 https://pypi.python.org/pypi/gntp/1.0.2
urllib3 [P] 1.12 https://pypi.python.org/pypi/urllib3/1.12

Note: The items above denoted with a [P] were patched in efforts to:

  • Make their libaries compatible with Python v2.6.
  • Fix bugs to add stability to the overall functionality.
  • Add the nessesary enhancments that benifit this wrapper tool.

John Gruber's python markdown is officially available here, but I chose to use this fork (by EnTeQuAk instead because it was backported to work with Python v2.6. The ticket here explains the reasoning.

To be as transparent as possible, all patches have been provided in the /patches directory.

Command Line

Notify.py has a built in command line interface that can be easily tied to a cron entry or can be easilly called from the command line to automate the fetching of subtitles.

Here are the switches available to you:

Usage: Notify.py [options]

Options:
  -h, --help            show this help message and exit
  -s URL(s), --servers=URL(s)
                        Specify 1 or more servers in their URL format ie:
                        growl://mypass@localhost
  -t TITLE, --title=TITLE
                        Specify the title of the notification message.
  -b BODY, --body=BODY  Specify the body of the notification message.
  -i, --include_image   Include image in message if the protocol supports it.
  -u IMAGE_URL, --image_url=IMAGE_URL
                        Provide url to image; should be either http://,
                        https://, or file://. This option implies that
                        --include_image (-i) is set automatically
  -L FILE, --logfile=FILE
                        Send output to the specified logfile instead of
                        stdout.
  -D, --debug           Debug Mode

Here is simple example:

# Send a notification to XBMC (assuming its listening on
# port 8080 at the ip 192.168.0.2 with respect to the example
# below:
python Notify.py -s xbmc://192.168.0.2 -t "Hello" -b "World!"

# you can also use it's new name (kodi) to achive the same
# results:
python Notify.py -s kodi://192.168.0.2 -t "Hello" -b "World!"

You can also mix and match as many servers as you want by separating your urls with a comma and/or space.

# Send a notification to XBMC and a Growl Server
python Notify.py \
    -s growl://192.168.0.10,xbmc://user:pass@192.168.0.2 \
    -t "Hello" -b "World!"

SABnzbd Users

SABnzbd users can test that their script is working okay manually as well if they're having issues with it through their application. This is also a great way to test out that you've created the correct URL string.

# Send a notification to XBMC (assuming its listening on
# port 8080 at the ip 192.168.0.2 with respect to the example
# below:
python sabnzbd-notify.py complete 'Hello' 'World' xbmc://192.168.0.2

The syntax is very similar except SABnzbd expects 4 distinct arguments.

Arg # Description
1 The type of notification we are sending. This has an impact on the icon (for those that support it) that you will pass along with the message.
2 The title of the notification message. If this is an empty string, then there is enough information based on the notification type you passed in (argument 1) to generate a title.
3 The message body.
4 Comma delmited URL strings just like the ones already discussed above.

SABnzbd Configuration

First, make sure you've placed sabnzb-notify.py, Notify.py, and the Notify inside of the /path/to/SABnzbd/scripts/ directory or the instructions below will not work.

Once you know the URL(s) that work for you, you can set SABnzbd to automatically notify setting it up as follows. From within SABnzbd's web interface:

  • Click on Settings
  • Click on Notifications
  • Place a checkbox in the Enable notification script option.
  • Choose sabnzb-notify.py from the Script dropdown menu.
  • Specify the URL such as kodi://192.168.0.2 in the Parameters section. You can specify more then one URL here by simply using a comma (,) as a delimiter.

CentOS/RedHat users can also refer to a blog entry I prepared for this which includes RPM packaging for both SABnzbd and NZB-Notify. These can be easily installed (with all required dependencies by just getting yourself set up with my repository here.

About

Push Notifications to a large number of supported services. It can be easily integrated into NZBGet and SABnzbd too.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.3%
  • HTML 2.4%
  • Other 0.3%