aboutsummaryrefslogtreecommitdiff
path: root/src/ask-tracker-for-more-peers.py
blob: 8b874f018b782223ed8079b052fd2155abe33843 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
import click
from transmission_rpc import Client


@click.command()
@click.option('--port', default=9091)
@click.option('--host', default="localhost")
def main(host, port):
    """ Reannounces all torrents that have not received any peers. """

    c = Client(host=host, port=port)
    torrents = c.get_torrents()
    for torrent in torrents:
        if torrent.progress == 0 and torrent.downloading:
            print(f"Reannouncing {torrent.name}")
            c.reannounce_torrent(torrent.id)


if __name__ == '__main__':
    main()