If you use Transmission this little python script will start all of your downloads when your screensaver kicks on and pause them when it turns off, i.e. you are at your terminal.
#!/usr/bin/env python import dbus, urllib from dbus.mainloop.glib import DBusGMainLoop START_TORRENTS = "http://localhost:9091/transmission/rpc?method=torrent-start" STOP_TORRENTS = "http://localhost:9091/transmission/rpc?method=torrent-stop" DBusGMainLoop(set_as_default=True) sess=dbus.SessionBus() def sig(screensaverActive): if screensaverActive: data = urllib.urlopen(START_TORRENTS).read() else: data = urllib.urlopen(STOP_TORRENTS).read() sess.add_signal_receiver(sig, 'ActiveChanged','org.gnome.ScreenSaver') import gobject loop = gobject.MainLoop() loop.run()via I can’t find it at the moment but I will update once I get the link.
![]()
UPDATE:
I found my source here. The comments also include a patch for throttling the app rather than outright pausing everything.
SECURITY: I should point out, as mentioned in this comment, the RPC for Transmission will allow a nefarious person to control your application with a web page that includes elements like:
<img src="http://localhost:9091/transmission/rpc?method=torrent-stop">It is assumed that most (all?) other RPC calls for the web interface of Transmission could be called the same way. This is a fairly large security hole and I would suggest using a password on the Transmission web interface if you enable it. Though if you do that would render this tip pretty much useless.
Tags: automation, bittorrent, python, rpc, security