Skip to content

Instantly share code, notes, and snippets.

@meinside
Last active August 29, 2019 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meinside/77f0a5be3bf301498f983f5c485a5ba1 to your computer and use it in GitHub Desktop.
Save meinside/77f0a5be3bf301498f983f5c485a5ba1 to your computer and use it in GitHub Desktop.
Broacast transmission download complete message and remove it from the list.
#!/bin/bash
#
# transmission-complete-broadcast.sh
#
# last update: 2019.08.29.
#
# for broadcasting transmission download complete message
# through telegram-bot-remotecontrol
# (github.com/meinside/telegram-bot-remotecontrol)
#
# Usage:
#
# 1. Setup and run telegram-bot-remotecontrol:
#
# https://github.com/meinside/telegram-bot-remotecontrol
#
# 2. Install telegram-bot-broadcast:
#
# $ go get -u github.com/meinside/telegram-bot-remotecontrol/cmd/telegram-bot-broadcast
#
# 3. Configure Transmission to run this script on download complete:
#
# $ sudo systemctl stop transmission-daemon.service
# $ sudo vi /etc/transmission-daemon/settings.json
#
# # change following values:
# "script-torrent-done-enabled": true,
# "script-torrent-done-filename": "/path/to/this/transmission-complete-broadcast.sh",
#
# $ sudo systemctl start transmission-daemon.service
# Download completed
BROADCAST_BIN="/path/to/telegram-bot-broadcast"
$BROADCAST_BIN "Transmission > Download completed: '$TR_TORRENT_NAME' in $TR_TORRENT_DIR"
# Remove completed torrent from the list
TRANSMISSION_REMOTE_BIN="/usr/bin/transmission-remote"
TRANSMISSION_REMOTE_ID="your-user-id"
TRANSMISSION_REMOTE_PASSWD="your-passwd"
$TRANSMISSION_REMOTE_BIN --auth "$TRANSMISSION_REMOTE_ID:$TRANSMISSION_REMOTE_PASSWD" -t $TR_TORRENT_ID --remove && \
$BROADCAST_BIN "Transmission > Removed: '$TR_TORRENT_NAME' from the list"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment