From efabde31ff74ed5ae31304fc970beca1d6fcf3b6 Mon Sep 17 00:00:00 2001
From: Eirik Byrkjeflot Anonsen <eirik@eirikba.org>
Date: Tue, 17 May 2011 20:51:50 +0200
Subject: [PATCH 3/4] Add seeding_time, active_time and tracker_status to deluge-console's "info" command.
---
deluge/ui/console/commands/info.py | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/deluge/ui/console/commands/info.py b/deluge/ui/console/commands/info.py
index e775bbe..09fbc29 100644
|
a
|
b
|
|
| 46 | 46 | status_keys = ["state", |
| 47 | 47 | "save_path", |
| 48 | 48 | "tracker", |
| | 49 | "tracker_status", |
| 49 | 50 | "next_announce", |
| 50 | 51 | "name", |
| 51 | 52 | "total_size", |
| … |
… |
|
| 67 | 68 | "file_progress", |
| 68 | 69 | "peers", |
| 69 | 70 | "is_seed", |
| 70 | | "is_finished" |
| | 71 | "is_finished", |
| | 72 | "active_time", |
| | 73 | "seeding_time" |
| 71 | 74 | ] |
| 72 | 75 | |
| 73 | 76 | |
| … |
… |
|
| 89 | 92 | s += "]" |
| 90 | 93 | return s |
| 91 | 94 | |
| | 95 | def format_time(seconds): |
| | 96 | minutes = seconds // 60 |
| | 97 | seconds = seconds - minutes * 60 |
| | 98 | hours = minutes // 60 |
| | 99 | minutes = minutes - hours * 60 |
| | 100 | days = hours // 24 |
| | 101 | hours = hours - days * 24 |
| | 102 | return "%d days %02d:%02d:%02d" % (days, hours, minutes, seconds) |
| | 103 | |
| | 104 | |
| 92 | 105 | |
| 93 | 106 | class Command(BaseCommand): |
| 94 | 107 | """Show information about the torrents""" |
| … |
… |
|
| 178 | 191 | s += " {!info!}Ratio: {!input!}%.3f" % status["ratio"] |
| 179 | 192 | self.console.write(s) |
| 180 | 193 | |
| | 194 | s = "{!info!}Seed time: {!input!}%s" % format_time(status["seeding_time"]) |
| | 195 | s += " {!info!}Active: {!input!}%s" % format_time(status["active_time"]) |
| | 196 | self.console.write(s) |
| | 197 | self.console.write("{!info!}Tracker status: {!input!}%s" % status["tracker_status"]) |
| | 198 | |
| 181 | 199 | if not status["is_finished"]: |
| 182 | 200 | if hasattr(self.console, "screen"): |
| 183 | 201 | cols = self.console.screen.cols |