Replaced 'inf' with '-' for ratio column in AllTorrents mode

This commit is contained in:
Asmageddon 2012-07-14 12:54:40 +02:00
parent 9c0c7b060c
commit ae8751461a
2 changed files with 4 additions and 2 deletions

View File

@ -55,7 +55,7 @@ def format_time(time):
def format_float(x): def format_float(x):
if x < 0: if x < 0:
return "inf" return "-"
else: else:
return "%.3f"%x return "%.3f"%x

View File

@ -453,7 +453,9 @@ class TorrentDetail(BaseMode, component.Component):
s+= common.fsize(status["total_uploaded"]) s+= common.fsize(status["total_uploaded"])
if status["upload_payload_rate"] > 0: if status["upload_payload_rate"] > 0:
s+= " {!yellow!}@ %s%s" % (up_color, common.fsize(status["upload_payload_rate"])) s+= " {!yellow!}@ %s%s" % (up_color, common.fsize(status["upload_payload_rate"]))
s+= " {!info!}Ratio: {!input!}%s" % format_utils.format_float(status["ratio"]) ratio_str = format_utils.format_float(status["ratio"])
if ratio_str == "-": ratio_str = "inf"
s+= " {!info!}Ratio: {!input!}%s" % ratio_str
self.add_string(off, s); off += 1 self.add_string(off, s); off += 1
#Seeder/leecher info #Seeder/leecher info