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/e4919c24b8884026ec6d to your computer and use it in GitHub Desktop.
Save JonnyWong16/e4919c24b8884026ec6d to your computer and use it in GitHub Desktop.
Get notified on Telegram when a user is transcoding
#!/bin/sh
# Written by pmow
# 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.
## Telegram notification basic script
### Based on Matriphe's at https://gist.github.com/matriphe/9a51169508f266d97313
#script parameters: {video_decision} {user} {title} {player} {platform}
USERID="<numeric ID from @IDBot>"
KEY="<the API key from @BotFather>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
TEXT="$2 is playing $3 on device $4 ($5) $1"
#Something like: Username is playing Movie Name on device My Device (Android) Transcode
if [ "$1" != "Direct Play" ] && [ "$1" != "Copy" ]; then
curl -s --max-time $TIMEOUT -d "chat_id=$USERID&disable_web_page_preview=1&text=$TEXT" $URL > /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment