From fa1274ab47cd2353ca77eedc2c0d5353824257c9 Mon Sep 17 00:00:00 2001 From: chliny Date: Sun, 6 Oct 2013 17:27:15 +0800 Subject: [PATCH] fix bug --- xfdown.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/xfdown.py b/xfdown.py index a366c6d..458d286 100755 --- a/xfdown.py +++ b/xfdown.py @@ -360,20 +360,16 @@ def __pushtor(self,myfile,filename): urlv1 = "http://lixian.qq.com/handler/bt_handler.php?cmd=readinfo" - newfile = os.path.join("/tmp/",self.__md5(filename)) - newfile = newfile + ".torrent" - shutil.copy2(myfile,newfile) - myfile = newfile - if os.path.isfile(myfile): + newfile = os.path.join("/tmp/",self.__md5(filename)) + newfile = newfile + ".torrent" + shutil.copy2(myfile,newfile) + myfile = newfile try: ireq = requests.post(urlv1,files={"myfile":open(myfile,'r')}) except: - try: - ireq = requests.post(urlv1,files={"myfile":open(myfile,'rb')}) - except Exception as e: - print (e) - return False + ireq = requests.post(urlv1,files={"myfile":open(myfile,'rb')}) + os.remove(myfile) else: try: ireq = requests.post(urlv1,files={"myfile":myfile})