Skip to content

Instantly share code, notes, and snippets.

@tree-s
Last active January 30, 2025 00:58
Show Gist options
  • Save tree-s/1b2177bac1d8f2b70fac9e235a7f262c to your computer and use it in GitHub Desktop.
Save tree-s/1b2177bac1d8f2b70fac9e235a7f262c to your computer and use it in GitHub Desktop.
--curl new torrents to a transmission web daemon
#!/bin/bash
test -z $1 && echo "need magnet link!
$0 <magnet link>" && exit -1
HOST=YourRemoteHostNameOrIP
PORT=YourPort(default is 9091)
USER=User
# NOTE: I had issues using passwords with semicolons (;) in them,
# you might want to stay away from them
PASS=pass
LINK="$1"
# set true if you want every torrent to be paused initially
#PAUSED="true"
PAUSED="false"
SESSID=$(curl --silent --anyauth --user $USER:$PASS "http://$HOST:$PORT/transmission/rpc" | sed 's/.*<code>//g;s/<\/code>.*//g')
curl --silent --anyauth --user $USER:$PASS --header "$SESSID" "http://$HOST:$PORT/transmission/rpc" -d "{\"method\":\"torrent-add\",\"arguments\":{\"paused\":${PAUSED},\"filename\":\"${LINK}\"}}"
@rpgdev
Copy link

rpgdev commented Jan 29, 2025

AI was being retarded about this and your gist saved me. Thanks!

@tree-s
Copy link
Author

tree-s commented Jan 30, 2025

AI was being retarded about this and your gist saved me. Thanks!

No problem glad it was of some use!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment