KODI Notify script

Come up with a useful post-processing script? Share it here!
Post Reply
Richard63
Newbie
Newbie
Posts: 17
Joined: January 18th, 2015, 3:58 pm

KODI Notify script

Post by Richard63 »

Hello i made an Notify script for Kody.tv mediaplayer.

It sends a message when a download is finished in SabNzbd.

i also use a pre post script wicht sends a notify when sab is beginning to download a movie in the queue.

Here is my script:

Code: Select all

#!/usr/bin/python
__author__ = 'Richard van Soest'
from urllib.request import urlopen
from urllib.request import Request
from urllib.parse import unquote
from urllib.parse import urlparse
import sys
import json
import urllib
#print ("---------------------")
#print(sys.version)
#print ("---------------------")

#print ("")

total = len(sys.argv)
cmdargs = str(sys.argv)

#following is for testing only

#print ("The total numbers of args passed to the script: %d " % total)
#print ("Args list: %s " % cmdargs)
#Pharsing args one by one 
#print ("Script name: %s" % str(sys.argv[0]))
#print ("First argument: %s" % str(sys.argv[1]))
#print ("Second argument: %s" % str(sys.argv[2]))
#print ("Third argument: %s" % str(sys.argv[3]))
#print ("Fourth argument: %s" % str(sys.argv[4]))
#print ("Fifth argument: %s" % str(sys.argv[5]))
#print ("Sixth argument: %s" % str(sys.argv[6]))
#print ("Seventh argument: %s" % str(sys.argv[7]))
#print ("----------------------")

# end testing

sentence = sys.argv[3]

new = sentence.replace(" ", "%20")
#print (new)

# set ip to your kodi player pc. LEAVE the text as is (no spaces or returns extra or it stops working)

url = 'http://192.168.2.4/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22displaytime%22:10000,%22title%22:%22SABNzbd%22,%22message%22:%22Finished%20'+new+'%22,%22image%22:%22http://sabnzbd.org/icon/sab2_512.png%22},%22id%22:1}'

response_stream = urlopen(url)

#print (url)

json_response = response_stream.read()

Richard63
Newbie
Newbie
Posts: 17
Joined: January 18th, 2015, 3:58 pm

Re: KODI Notify script

Post by Richard63 »

Just put this script in the categorie setup
Post Reply