updated with new params and additional information

pmow
2016-02-21 08:53:28 -05:00
parent 33265ce970
commit 78d0359e0c

@@ -1,12 +1,17 @@
## Telegram notification basic script
### From https://gist.github.com/matriphe/9a51169508f266d97313
To enable scripts, set a Script Folder at Settings > Notification Agents > Scripts. Place any script files in this directory with appropriate permissions (executable and accessible to the PlexPy user).
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.
#!/bin/sh
# Just alerts on {video_decision} as first parameter, must be specified in script settings.
## 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="Crap, your server is transcoding something: ! Go check on it, noob!"
TEXT="$2 is playing $3 on device $4 ($5) $1"
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