Skip to content

Instantly share code, notes, and snippets.

@tynn
Last active January 1, 2016 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tynn/8149610 to your computer and use it in GitHub Desktop.
Save tynn/8149610 to your computer and use it in GitHub Desktop.
Add a torrent to Transmission with the download directory set to the torrents parent directory. This might not work as intended if Transmission already keeps track of the torrent to be added or for any other reason.
#!/usr/bin/env python
# 2013 CC0 http://creativecommons.org/publicdomain/zero/1.0/
import os.path, sys, transmissionrpc
tc = transmissionrpc.Client()
for torrent in map(os.path.abspath, sys.argv[1:]) :
try : tc.add_torrent(torrent, download_dir = os.path.dirname(torrent))
except : print ("Failed adding {0:s}".format(torrent))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment