From cc3f4a0e5efb5b0961333817092f4086c104dcc6 Mon Sep 17 00:00:00 2001 From: chliny Date: Sat, 5 Oct 2013 12:37:33 +0800 Subject: [PATCH] fix bug --- xfdown.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xfdown.py b/xfdown.py index ab5cfb2..41a8156 100755 --- a/xfdown.py +++ b/xfdown.py @@ -371,7 +371,11 @@ def __pushtor(self,url): defaultchose = [] totalsize = 0 for fileentry in torinfo["files"]: - totalsize += fileentry["file_size_ori"] + try: + totalsize += fileentry["file_size_ori"] + except: + print ("torrent error!") + return False aversize = totalsize / len(torinfo["files"]) _print ("序号\t大小\t文件名") @@ -379,7 +383,12 @@ def __pushtor(self,url): name = fileentry["file_name"] size = fileentry["file_size"] index = fileentry["file_index"] - _print ("%d\t%s\t%s" % (index,size,name)) + try: + _print ("%d\t%s\t%s" % (index,size,name)) + except: + print ("torrent error") + return False + if fileentry["file_size_ori"] >= aversize: defaultchose.append(str(index))