Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chliny committed Oct 6, 2013
1 parent 7ded413 commit fa1274a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions xfdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit fa1274a

Please # to comment.