Skip to content

Instantly share code, notes, and snippets.

@JonnyWong16
Last active June 30, 2016 18:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonnyWong16/3591d1fee289daaafeb8 to your computer and use it in GitHub Desktop.
Save JonnyWong16/3591d1fee289daaafeb8 to your computer and use it in GitHub Desktop.
Get notified on Telegram when a user is transcoding
# Written by pmow/Hellowlol
# Upload to Gist by JonnyWong16
# For this video transcode alert script, you should select the script for action types where it would be useful:
# Playback Start and Playback Resume, for example.
# Under Settings > Notifications > Scripts, set the parameters that should get passed to the script.
import sys
import requests
# sys.argv[1] is the first argument
# sys.argv[2] is the second argument etc
USERID = '<numeric ID from @IDBot>'
KEY= '<the API key from @BotFather>'
TIMEOUT= 10
URL = 'https://api.telegram.org/bot$KEY/sendMessage'
TEXT = 'Crap, your server is transcoding something: ! Go check on it, noob!'
url = URL + chat_id=%s&disable_web_page_preview=1&text=%s % (KEY, TEXT)
if sys.argv[1] != 'Direct Play' and sys.arv[1] != 'Copy':
requests.get(url, timeout=timeout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment