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– BraiamMar 22, 2016 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.– rosuavMar 22, 2016 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– BraiamMar 22, 2016 at 20:09
1 Answer
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).– rosuavJul 17, 2016 at 20:22