本文整理匯總了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()