#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 -p sane-scripts.lib.bt
# vim: set filetype=python :

import argparse
import logging

from sane_bt import TransmissionApi


def main():
    logging.basicConfig()
    logging.getLogger().setLevel(logging.INFO)

    parser = argparse.ArgumentParser(description="remove a torrent and trash its data")
    TransmissionApi.add_arguments(parser)
    parser.add_argument("torrent", help="numerical ID of the torrent in the transmission list (see sane-bt-show)", nargs="+")

    args = parser.parse_args()
    bt_api = TransmissionApi.from_arguments(args)
    torrents = args.torrent

    for torrent in torrents:
        bt_api.rm_torrent(torrent)

if __name__ == "__main__":
    main()
