2

I have a script that surrounds a particular program with setup and teardown commands involving networking/routing etc. I'd like to add control of Transmission to that, such that while the program's running, Transmission is in "turtle mode", as if I'd clicked the button to activate the lower bandwidth limits. Is there a way to do this? Editing the config file kinda works, but I haven't found a way to tell Transmission-GTK to reload its configs without restarting.

  • transmission uses RCP, trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt – Braiam Mar 22 '16 at 15:31
  • I'm specifically talking about Transmission-GTK here; this is not the background daemon. Are you talking about the "Remote Control" feature? Is that RCP also, or is it designed to be used by a web browser? Neither your answer, nor the page you linked to (and nor, for that matter, the settings notebook) is clear on this. If that works out, I'll post an answer here, because it's decidedly unobvious and needs to be posted. – rosuav Mar 22 '16 at 16:53
  • I didn't "answer" your question, it was just a comment. And if I'm not mistaken the gui uses the daemon in the background – Braiam Mar 22 '16 at 20:09
0

Thanks to Braiam's hint, I've figured this out. In the Preferences dialog, make sure "Remote Access" is enabled, and check the port (I'm assuming it's the default of 9091). To activate turtle mode:

hdr=`curl http://localhost:9091/transmission/rpc -sD- |grep -o '^X-Transmission-Session-Id: [A-Za-z0-9]*'`
curl http://localhost:9091/transmission/rpc -d '{"method":"session-set","arguments":{"alt-speed-enabled":true}}' -H "$hdr"

And to deactivate turtle afterward:

curl http://localhost:9091/transmission/rpc -d '{"method":"session-set","arguments":{"alt-speed-enabled":false}}' -H "$hdr"

Leaving this for the next person!

  • Depending on how long it is between activating and deactivating, you may need to rerun the hdr= line before deactivating. In a generalized script, that'd be the safest way (one more round trip to localhost is pretty cheap). – rosuav Jul 17 '16 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.