iambus/xunlei-lixian — Issue #13: python2.6运行lixian_cli.py发生错误以及aria2的支持。
Author: wjchen
Created: 2011-12-07 05:26:34+00:00
State: open

python2.6运行lixian_cli.py发生一些错误，自己修改一下正常了，还有aria2输出文件名是--out选项。
以下是我的修改。
gdriveid = str(client.get_gdriveid())
-	aria2_opts = ['aria2c', '--header=Cookie: gdriveid='+gdriveid, download_url]
-	aria2_opts.extends(('--split', '5')) #AttributeError: 'list' object has no attribute 'extends'(python 2.6.5)
-	aria2_opts.extends(('--output-file', filename)) # TODO: this option seems not supported by aria2c ... use --out for aria2
+	aria2_opts = ['aria2c', '--header=Cookie: gdriveid='+gdriveid, '--split=5', '--out='+filename, download_url]
+	#aria2_opts.extends(('--split', '5'))
+	#aria2_opts.extends(('--out', filename)) # TODO: this option seems not supported by aria2c ...
if resuming:
aria2_opts.append('-c')
exit_code = subprocess.call(aria2_opts)
@@ -212,7 +212,7 @@ def aria2_download(client, download_url, filename, resuming=False):
# TODO: support axel, ProZilla

def escape_filename(name):
-	name = re.sub(r'&(amp;)+', '&', name, flags=re.I) #TypeError: sub() got an unexpected keyword argument 'flags'
+	name = re.sub(r'&(amp;)+', '&', name, re.I)
name = re.sub(r'[\\/:*?"<>|]', '-', name)
return name