Ticket #1857: 0003-Add-seeding_time-active_time-and-tracker_status-to-d.patch

File 0003-Add-seeding_time-active_time-and-tracker_status-to-d.patch, 2.0 KB (added by eirikba, 13 years ago)
  • deluge/ui/console/commands/info.py

    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  
    4646status_keys = ["state", 
    4747        "save_path", 
    4848        "tracker", 
     49        "tracker_status", 
    4950        "next_announce", 
    5051        "name", 
    5152        "total_size", 
     
    6768        "file_progress", 
    6869        "peers", 
    6970        "is_seed", 
    70         "is_finished" 
     71        "is_finished", 
     72        "active_time", 
     73        "seeding_time" 
    7174        ] 
    7275 
    7376 
    def format_progressbar(progress, width): 
    8992    s += "]" 
    9093    return s 
    9194 
     95def 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 
    92105 
    93106class Command(BaseCommand): 
    94107    """Show information about the torrents""" 
    def show_info(self, torrent_id, status, verbose=False): 
    178191        s += " {!info!}Ratio: {!input!}%.3f" % status["ratio"] 
    179192        self.console.write(s) 
    180193 
     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 
    181199        if not status["is_finished"]: 
    182200            if hasattr(self.console, "screen"): 
    183201                cols = self.console.screen.cols