Skip to content

Commit

Permalink
尝试增加BT下载任务
Browse files Browse the repository at this point in the history
  • Loading branch information
chliny committed Jun 2, 2013
1 parent fb30b35 commit 94b459a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cookie
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ http://lixian.qq.com/
调用aria2下载
可实现多线程,断点续传等特性

12 12 29 修复腾讯改版后无法登陆,和登陆验证referer
12 12 29 修复腾讯改版后无法登陆,和登陆验证referer
43 changes: 36 additions & 7 deletions xfdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,40 @@ def __addtask(self):
else:
url = self._addurl
filename=self.getfilename_url(url)
data={"down_link":url,\
"filename":filename,\
"filesize":0,\
}
urlv="http://lixian.qq.com/handler/lixian/add_to_lixian.php"
str = self.__request(urlv,data)
if os.path.isfile(url):
filesize=os.path.getsize(filename)
orisize = filesize
dw=["B","K","M","G"]
for i in range(4):
_dw=dw[i]
if filesize>=1024:
filesize=filesize/1024
else:
break
filesize="%.1f%s"%(filesize,_dw)
filecontent = open(filename,'rb').read()
hash = self.__md5(filecontent)

data={"name":"myfile",\
"ret":0,\
"hash":hash,\
"files":[{"file_name":filename,\
"file_size":filesize,\
"file_size_ori":orisize,\
"file_index":0,\
}]
}
print data
urlv="http://lixian.qq.com/handler/bt_handler.php?cmd=readinfo"
str = self.__request(urlv,data)
print str
else:
data={"down_link":url,\
"filename":filename,\
"filesize":0,\
}
urlv="http://lixian.qq.com/handler/lixian/add_to_lixian.php"
str = self.__request(urlv,data)

def __online(self):
_print("输入需要在线观看的任务序号")
Expand Down Expand Up @@ -440,7 +468,8 @@ def usage():
print(" -h,--help\tshow this usage and exit.")
print(" -d <dir>,--downloaddir=<dir>\n\tset the download dir.")
print(" -p <player>,--player=<player>\n\tset the player.")
print("\n\nsee https://github.com/kikyous/xfdown for most newest version and more information")
print(" -A <url>,--add=<url>\n\tadd the url to offline task.")
print("\n\nsee https://github.com/chliny/xfdown for most newest version and more information")
try:
xf = XF()
if not hasattr(xf,"_downpath"):
Expand Down

0 comments on commit 94b459a

Please # to comment.