Skip to content

Commit

Permalink
Merge pull request kikyous#2 from maplebeats/master
Browse files Browse the repository at this point in the history
增加连续任务选择
  • Loading branch information
kikyous committed Aug 30, 2012
2 parents 44668ac + 7b03d72 commit d87578b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion xfdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,17 @@ def __chosetask(self):
self.main()

def __getdownload(self):
_print ("请输入要下载的任务序号,数字之间用空格或其他字符分隔.\n输入A下载所有任务:")
_print ("请输入要下载的任务序号,数字之间用空格或其他字符分隔.或者使用-来选择连续任务\n输入A下载所有任务:")
_print ("(数字后跟p只打印下载命令而不下载,比如1p2p3)")
target=raw_input("dl # ").strip()
if target.upper()=="A":
lists=zip(range(1,len(self.filehash)+1) , ['']* len(self.filehash))
elif '-' in target:
nums = []
for i in target.split(' '):
ran = i.split('-')
nums.extend(range(int(ran[0]),int(ran[1])+1))
lists = zip(nums , [''] * len(nums))
else:
lists=self.__RE.findall(target)
if lists==[]:
Expand All @@ -303,6 +309,12 @@ def __deltask(self):
target=raw_input("dt # ").strip()
if target.upper()=="A":
lists=zip(range(1,len(self.filehash)+1) , ['']* len(self.filehash))
elif '-' in target:
nums = []
for i in target.split():
ran = target.split('-')
nums.extend(range(int(ran[0]),int(ran[1])+1))
lists = zip(nums , [''] * len(nums))
else:
lists=self.__RE.findall(target)
if lists==[]:
Expand Down

0 comments on commit d87578b

Please # to comment.