check for pausedUP state

This commit is contained in:
Jeffrey Serio 2024-07-27 21:01:18 -05:00
parent 0f07829f4d
commit 4a72d27766

View File

@ -48,19 +48,16 @@ if __name__ == "__main__":
qb = Client(args["HOSTNAME"])
qb.login(username=args["USERNAME"], password=args["PASSWORD"])
# get torrents
torrents = qb.torrents()
# get total_completed_bytes
completed_torrent_sizes = list()
for torrent in torrents:
if torrent.get("state") == "queuedUP": # type: ignore
completed_torrent_sizes.append(torrent.get("total_size")) # type: ignore
completed_torrent_sizes = []
for torrent in qb.torrents():
if torrent["state"] == "queuedUP" or torrent["state"] == "pausedUP": # type: ignore
completed_torrent_sizes.append(torrent["total_size"]) # type: ignore
total_completed_bytes = sum(completed_torrent_sizes)
# get total_added_bytes
total_added_bytes = sum([torrent.get("total_size") for torrent in torrents]) # type: ignore
total_added_bytes = sum([torrent["total_size"] for torrent in torrents]) # type: ignore
# print the results
print(f"\nTotal completed size: {human_bytes(total_completed_bytes)}")