sane-bt-show: allow showing multiple torrents (again)

This commit is contained in:
Colin 2023-06-22 22:32:38 +00:00
parent 21a060d856
commit 74ec65c8a9

View File

@ -9,14 +9,15 @@ from sane_bt import MediaMeta, TransmissionApi
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
TransmissionApi.add_arguments(parser) TransmissionApi.add_arguments(parser)
parser.add_argument("torrent", nargs="?", help="torrent id to show (acquire by first calling with no args)") parser.add_argument("torrents", nargs="*", help="torrent id to show (acquire by first calling with no args)")
args = parser.parse_args() args = parser.parse_args()
bt_api = TransmissionApi.from_arguments(args) bt_api = TransmissionApi.from_arguments(args)
torrent = args.torrent torrents = args.torrents
if torrent: if torrents:
print(bt_api.info(torrent)) for t in torrents:
print(bt_api.info(t))
else: else:
print(bt_api.list_()) print(bt_api.list_())