mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-25 09:03:41 +01:00
check for pausedUP state
This commit is contained in:
parent
0f07829f4d
commit
4a72d27766
@ -48,19 +48,16 @@ if __name__ == "__main__":
|
|||||||
qb = Client(args["HOSTNAME"])
|
qb = Client(args["HOSTNAME"])
|
||||||
qb.login(username=args["USERNAME"], password=args["PASSWORD"])
|
qb.login(username=args["USERNAME"], password=args["PASSWORD"])
|
||||||
|
|
||||||
# get torrents
|
|
||||||
torrents = qb.torrents()
|
|
||||||
|
|
||||||
# get total_completed_bytes
|
# get total_completed_bytes
|
||||||
completed_torrent_sizes = list()
|
completed_torrent_sizes = []
|
||||||
for torrent in torrents:
|
for torrent in qb.torrents():
|
||||||
if torrent.get("state") == "queuedUP": # type: ignore
|
if torrent["state"] == "queuedUP" or torrent["state"] == "pausedUP": # type: ignore
|
||||||
completed_torrent_sizes.append(torrent.get("total_size")) # type: ignore
|
completed_torrent_sizes.append(torrent["total_size"]) # type: ignore
|
||||||
|
|
||||||
total_completed_bytes = sum(completed_torrent_sizes)
|
total_completed_bytes = sum(completed_torrent_sizes)
|
||||||
|
|
||||||
# get total_added_bytes
|
# 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 the results
|
||||||
print(f"\nTotal completed size: {human_bytes(total_completed_bytes)}")
|
print(f"\nTotal completed size: {human_bytes(total_completed_bytes)}")
|
||||||
|
Loading…
Reference in New Issue
Block a user