本文整理汇总了Python中pyload.webui.PYLOAD.statusDownloads方法的典型用法代码示例。如果您正苦于以下问题:Python PYLOAD.statusDownloads方法的具体用法?Python PYLOAD.statusDownloads怎么用?Python PYLOAD.statusDownloads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyload.webui.PYLOAD
的用法示例。
在下文中一共展示了PYLOAD.statusDownloads方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: home
# 需要导入模块: from pyload.webui import PYLOAD [as 别名]
# 或者: from pyload.webui.PYLOAD import statusDownloads [as 别名]
def home():
try:
res = [toDict(x) for x in PYLOAD.statusDownloads()]
except Exception:
s = request.environ.get('beaker.session')
s.delete()
return redirect("/login")
for link in res:
if link["status"] == 12:
link["information"] = "%s kB @ %s kB/s" % (link["size"] - link["bleft"], link["speed"])
return render_to_response("home.html", {"res": res}, [pre_processor])
示例2: links
# 需要导入模块: from pyload.webui import PYLOAD [as 别名]
# 或者: from pyload.webui.PYLOAD import statusDownloads [as 别名]
def links():
try:
links = [toDict(x) for x in PYLOAD.statusDownloads()]
ids = []
for link in links:
ids.append(link['fid'])
if link['status'] == 12:
link['info'] = "%s @ %s/s" % (link['format_eta'], formatSize(link['speed']))
elif link['status'] == 5:
link['percent'] = 0
link['size'] = 0
link['bleft'] = 0
link['info'] = _("waiting %s") % link['format_wait']
else:
link['info'] = ""
data = {'links': links, 'ids': ids}
return data
except Exception, e:
traceback.print_exc()
return HTTPError()