Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions added/Telegram Notify/Telegram Notify.conf
Original file line number Diff line number Diff line change
@@ -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": ""
}
}
29 changes: 29 additions & 0 deletions added/Telegram Notify/Telegram Notify.py
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions finished/Telegram Notify/Telegram Notify.conf
Original file line number Diff line number Diff line change
@@ -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": ""
}
}
29 changes: 29 additions & 0 deletions finished/Telegram Notify/Telegram Notify.py
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions snatched/Telegram Notify/Telegram Notify.conf
Original file line number Diff line number Diff line change
@@ -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": ""
}
}
29 changes: 29 additions & 0 deletions snatched/Telegram Notify/Telegram Notify.py
Original file line number Diff line number Diff line change
@@ -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)