Last active
May 3, 2020 02:56
-
-
Save flying-sausages/19e8e798c1257b5341c03b5770dd2a80 to your computer and use it in GitHub Desktop.
Transmission post-download script: Sort Torrents in folders by tracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#Requires transmission-remote in $PATH. | |
#Make sure you are allowing the RPC and are not being limited by the whitelist | |
#First see how can you log in to transmission and then adjust these values | |
#Try running `transmission-remote` first and see what happens | |
TR_USERNAME="username" | |
TR_PASSWORD="password" | |
# might be able to leave empty, test it out. I'm running mine through an nginx reverse proxy. | |
TR_HOST="https://localhost/transmission/rpc" | |
TRACKER=$(transmission-remote $TR_HOST -n "$TR_USERNAME":"$TR_PASSWORD" -t$TR_TORRENT_ID -it | sed -n -e '/[:]/p' | head -1 | awk '{print substr($0, index($0,$3))}' | awk -F[/:] '{print $4}') | |
dir="${TR_TORRENT_DIR}/${TRACKER}" | |
if [[ ! -d "$dir" ]]; then | |
mkdir -p "$dir" | |
fi | |
transmission-remote $TR_HOST -n "$TR_USERNAME":"$TR_PASSWORD" -t$TR_TORRENT_ID --move "$dir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script will create folders in your default torrent directory based off what the domain of the first tracker is.
For example, if you download The ubuntu 20.04 server torrent, it will make a folder called
torrent.ubuntu.com
and move the torrent data there.You can read more about Transmission scripting here https://github.com/transmission/transmission/wiki/Scripts
Originally adapted from the script in this thread https://forum.transmissionbt.com/viewtopic.php?t=12544