Skip to content

Instantly share code, notes, and snippets.

@thurask
Created July 12, 2016 17:21
Show Gist options
  • Save thurask/7c0e8fa97663da94c2bbe161d2796cad to your computer and use it in GitHub Desktop.
Save thurask/7c0e8fa97663da94c2bbe161d2796cad to your computer and use it in GitHub Desktop.
Add trackers to all torrents in Transmission
import argparse
import subprocess
import sys
def do(id, tracker):
subprocess.call(["transmission-remote", "-t", id, "-td", tracker])
def get():
q = subprocess.check_output(["transmission-remote", "-l"])
w = q.split("\n")[1:]
e = [x.split(" ") for x in w if x]
r = [x[1] for x in e if x[1]]
return r
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Add tracker to Transmission download")
parser.add_argument("trackers", nargs="+")
args = parser.parse_args(sys.argv[1:])
torrents = get()
for tracker in args.trackers:
for torrent in torrents:
do(torrent, tracker)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment