Created
July 12, 2016 17:21
-
-
Save thurask/7c0e8fa97663da94c2bbe161d2796cad to your computer and use it in GitHub Desktop.
Add trackers to all torrents in Transmission
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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