Skip to content

Instantly share code, notes, and snippets.

@flyingdan
Created October 2, 2020 01:38
Show Gist options
  • Save flyingdan/bdc9d5b4efbfc2e159da2daf4617dcce to your computer and use it in GitHub Desktop.
Save flyingdan/bdc9d5b4efbfc2e159da2daf4617dcce to your computer and use it in GitHub Desktop.
Script to add magnet links to tranmission
#!/usr/bin/env bash
/bin/rm /watch/emptied* # clear flag
tr=$(which transmission-remote) # set path for transmission-remote binary
for t in /watch/*.magnet; do
m=$(cat "$t") # get contents of magnet file
$tr --add $m # add to transmission
/bin/rm "$t" # delete the magnet file
done
for t in /watch/*.torrent; do
$tr --add $t # add to transmission
/bin/rm "$t" # delete torrent file
done
touch /watch/emptied-$(/bin/date +%Y%m%d-%H%M%S) # make emptied flag to indicate script was run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment