diff --git a/added/Telegram Notify/Telegram Notify.conf b/added/Telegram Notify/Telegram Notify.conf new file mode 100644 index 0000000..c3c0bcf --- /dev/null +++ b/added/Telegram Notify/Telegram Notify.conf @@ -0,0 +1,17 @@ +{ + "Config Version": 2, + "botid": { + "display": 0, + "type": "string", + "label": "Bot API token", + "helptext": "Contact @BotFather on Telegram to set up a bot", + "value": "" + }, + "chatid": { + "display": 1, + "type": "string", + "label": "User/Group ID", + "helptext": "Contact @myidbot on Telegram to get an ID", + "value": "" + } +} diff --git a/added/Telegram Notify/Telegram Notify.py b/added/Telegram Notify/Telegram Notify.py new file mode 100644 index 0000000..a6bb4a6 --- /dev/null +++ b/added/Telegram Notify/Telegram Notify.py @@ -0,0 +1,29 @@ +# /usr/bin/python3 +# Watcher Plugin to send Telegram Notifications +# Trigger: Snatched Release + +import sys +import json +import http.client, urllib +from time import strftime + +script, title, year, imdbid, resolution, conf_json = sys.argv + +conf = json.loads(conf_json) + +botid = conf['botid'] +chatid = conf['chatid'] + +body = 'Movie {} ({}) added.'.format(title, year) + +conn = http.client.HTTPSConnection("api.telegram.org:443") + +conn.request("POST", "/bot{}/sendMessage".format(botid), + urllib.parse.urlencode({ + "chat_id": chatid, + "text": body, + }), { "Content-type": "application/x-www-form-urlencoded" }) + +conn.getresponse() + +sys.exit(0) diff --git a/finished/Telegram Notify/Telegram Notify.conf b/finished/Telegram Notify/Telegram Notify.conf new file mode 100644 index 0000000..c3c0bcf --- /dev/null +++ b/finished/Telegram Notify/Telegram Notify.conf @@ -0,0 +1,17 @@ +{ + "Config Version": 2, + "botid": { + "display": 0, + "type": "string", + "label": "Bot API token", + "helptext": "Contact @BotFather on Telegram to set up a bot", + "value": "" + }, + "chatid": { + "display": 1, + "type": "string", + "label": "User/Group ID", + "helptext": "Contact @myidbot on Telegram to get an ID", + "value": "" + } +} diff --git a/finished/Telegram Notify/Telegram Notify.py b/finished/Telegram Notify/Telegram Notify.py new file mode 100644 index 0000000..04e4fd7 --- /dev/null +++ b/finished/Telegram Notify/Telegram Notify.py @@ -0,0 +1,29 @@ +# /usr/bin/python3 +# Watcher Plugin to send Telegram Notifications +# Trigger: Snatched Release + +import sys +import json +import http.client, urllib +from time import strftime + +script, title, year, imdbid, resolution, kind, downloader, downloadid, indexer, info_link, conf_json = sys.argv + +conf = json.loads(conf_json) + +botid = conf['botid'] +chatid = conf['chatid'] + +body = 'Movie {} ({}) downloaded using {} from {}.'.format(title, year, downloader, indexer, info_link) + +conn = http.client.HTTPSConnection("api.telegram.org:443") + +conn.request("POST", "/bot{}/sendMessage".format(botid), + urllib.parse.urlencode({ + "chat_id": chatid, + "text": body, + }), { "Content-type": "application/x-www-form-urlencoded" }) + +conn.getresponse() + +sys.exit(0) diff --git a/snatched/Telegram Notify/Telegram Notify.conf b/snatched/Telegram Notify/Telegram Notify.conf new file mode 100644 index 0000000..c3c0bcf --- /dev/null +++ b/snatched/Telegram Notify/Telegram Notify.conf @@ -0,0 +1,17 @@ +{ + "Config Version": 2, + "botid": { + "display": 0, + "type": "string", + "label": "Bot API token", + "helptext": "Contact @BotFather on Telegram to set up a bot", + "value": "" + }, + "chatid": { + "display": 1, + "type": "string", + "label": "User/Group ID", + "helptext": "Contact @myidbot on Telegram to get an ID", + "value": "" + } +} diff --git a/snatched/Telegram Notify/Telegram Notify.py b/snatched/Telegram Notify/Telegram Notify.py new file mode 100644 index 0000000..1aba4aa --- /dev/null +++ b/snatched/Telegram Notify/Telegram Notify.py @@ -0,0 +1,29 @@ +# /usr/bin/python3 +# Watcher Plugin to send Telegram Notifications +# Trigger: Snatched Release + +import sys +import json +import http.client, urllib +from time import strftime + +script, title, year, imdbid, resolution, kind, downloader, downloadid, indexer, info_link, conf_json = sys.argv + +conf = json.loads(conf_json) + +botid = conf['botid'] +chatid = conf['chatid'] + +body = 'Movie {} ({}) snatched using {} from {}.'.format(title, year, downloader, indexer, info_link) + +conn = http.client.HTTPSConnection("api.telegram.org:443") + +conn.request("POST", "/bot{}/sendMessage".format(botid), + urllib.parse.urlencode({ + "chat_id": chatid, + "text": body, + }), { "Content-type": "application/x-www-form-urlencoded" }) + +conn.getresponse() + +sys.exit(0)