From 787a9421d1a61229b838dcbf17734c42172800f7 Mon Sep 17 00:00:00 2001 From: jwansek Date: Thu, 25 Aug 2022 14:19:10 +0000 Subject: Renamed template files, added active for torrents --- services.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'services.py') diff --git a/services.py b/services.py index 681c82a..3680216 100755 --- a/services.py +++ b/services.py @@ -70,6 +70,7 @@ def get_docker_stats(): for container in client.containers.list(all = True) } +# currently unused @timeout def get_qbit_stats(): numtorrents = 0 @@ -98,11 +99,13 @@ def get_trans_stats(): # password = app.CONFIG["transmission"]["passwd"] ) stats = json.loads(client.session.stats().json()) + active_for = datetime.timedelta(seconds = stats["arguments"]["cumulative_stats"]["seconds_active"]) return { "bytes_dl": humanbytes(stats["arguments"]["cumulative_stats"]["downloaded_bytes"]), "bytes_up": humanbytes(stats["arguments"]["cumulative_stats"]["uploaded_bytes"]), "num": stats["arguments"]["torrent_count"], - "ratio": "%.3f" % (float(stats["arguments"]["cumulative_stats"]["uploaded_bytes"]) / float(stats["arguments"]["cumulative_stats"]["downloaded_bytes"])) + "ratio": "%.3f" % (float(stats["arguments"]["cumulative_stats"]["uploaded_bytes"]) / float(stats["arguments"]["cumulative_stats"]["downloaded_bytes"])), + "active_for": str(active_for) } @timeout @@ -228,8 +231,4 @@ def link_deleted(url): return text[text.find("") + 7 : text.find("")] in ["Error | nitter", "イラストコミュニケーションサービス[pixiv]"] if __name__ == "__main__": - sbi = get_random_image(["lio_fotia", "promare"]) - print(sbi.tags) - print(sbi.source) - print(sbi.imurl) - print(sbi.remove_tag("promare")) + print(get_trans_stats()) -- cgit v1.2.3