aboutsummaryrefslogtreecommitdiff
path: root/scripts/tag-based-on-dir.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/tag-based-on-dir.py')
-rwxr-xr-xscripts/tag-based-on-dir.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/scripts/tag-based-on-dir.py b/scripts/tag-based-on-dir.py
deleted file mode 100755
index 8cec41b..0000000
--- a/scripts/tag-based-on-dir.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python3
-import click
-from transmission_rpc import Client
-
-
-@click.command()
-@click.option('--port', default=9091)
-@click.option('--root-dir', default="/downloads/complete")
-@click.option('--host', default="localhost")
-def main(host, port, root_dir):
- """Adds tags to torrents based on their download directory."""
-
- c = Client(host=host, port=port)
- torrents = c.get_torrents()
- for torrent in torrents:
- dir = torrent.download_dir.replace(root_dir, '')
- label = 'none'
- if dir != '':
- label = dir.split('/')[1]
-
- labels = list([label])
- labels.extend(x for x in torrent.labels if x not in labels)
-
- if set(labels) != set(torrent.labels):
- print(f"Tagging {torrent.name}")
- c.change_torrent(torrent.id, labels=labels)
-
-
-if __name__ == '__main__':
- main()