本文整理汇总了Python中pyload.webui.PYLOAD.getConfig方法的典型用法代码示例。如果您正苦于以下问题:Python PYLOAD.getConfig方法的具体用法?Python PYLOAD.getConfig怎么用?Python PYLOAD.getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyload.webui.PYLOAD
的用法示例。
在下文中一共展示了PYLOAD.getConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: config
# 需要导入模块: from pyload.webui import PYLOAD [as 别名]
# 或者: from pyload.webui.PYLOAD import getConfig [as 别名]
def config():
conf = PYLOAD.getConfig()
plugin = PYLOAD.getPluginConfig()
conf_menu = []
plugin_menu = []
for entry in sorted(conf.keys()):
conf_menu.append((entry, conf[entry].description))
last_name = None
for entry in sorted(plugin.keys()):
desc = plugin[entry].description
name, none, type = desc.partition("_")
if type in PYLOAD.core.pluginManager.TYPES:
if name == last_name or len([a for a, b in plugin.iteritems() if b.description.startswith(name + "_")]) > 1:
desc = name + " (" + type.title() + ")"
else:
desc = name
last_name = name
plugin_menu.append((entry, desc))
accs = PYLOAD.getAccounts(False)
for data in accs:
if data.trafficleft == -1:
data.trafficleft = _("unlimited")
elif not data.trafficleft:
data.trafficleft = _("not available")
else:
data.trafficleft = formatSize(data.trafficleft)
if data.validuntil == -1:
data.validuntil = _("unlimited")
elif not data.validuntil:
data.validuntil = _("not available")
else:
t = time.localtime(data.validuntil)
data.validuntil = time.strftime("%d.%m.%Y - %H:%M:%S", t)
try:
data.options['time'] = data.options['time'][0]
except Exception:
data.options['time'] = "0:00-0:00"
if "limitDL" in data.options:
data.options['limitdl'] = data.options['limitDL'][0]
else:
data.options['limitdl'] = "0"
return render_to_response('settings.html',
{'conf': {'plugin': plugin_menu, 'general': conf_menu, 'accs': accs},
'types': PYLOAD.getAccountTypes()},
[pre_processor])