MCPcopy Index your code
hub / github.com/pyload/pyload / config

Function config

module/web/pyload_app.py:333–391  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

331@route("/settings")
332@login_required('SETTINGS')
333def config():
334 conf = PYLOAD.getConfig()
335 plugin = PYLOAD.getPluginConfig()
336
337 conf_menu = []
338 plugin_menu = []
339
340 for entry in sorted(conf.keys()):
341 conf_menu.append((entry, conf[entry].description))
342
343 for entry in sorted(plugin.keys()):
344 plugin_menu.append((entry, plugin[entry].description))
345
346 accs = []
347
348 for data in PYLOAD.getAccounts(False):
349 if data.trafficleft == -1:
350 trafficleft = _("unlimited")
351 elif not data.trafficleft:
352 trafficleft = _("not available")
353 else:
354 trafficleft = formatSize(data.trafficleft)
355
356 if data.validuntil == -1:
357 validuntil = _("unlimited")
358 elif not data.validuntil :
359 validuntil = _("not available")
360 else:
361 t = time.localtime(data.validuntil)
362 validuntil = time.strftime("%d.%m.%Y", t)
363
364 if "time" in data.options:
365 try:
366 _time = data.options["time"][0]
367 except:
368 _time = ""
369 else:
370 _time = ""
371
372 if "limitDL" in data.options:
373 try:
374 limitdl = data.options["limitDL"][0]
375 except:
376 limitdl = "0"
377 else:
378 limitdl = "0"
379
380 accs.append({'type': data.type,
381 'login': data.login,
382 'valid': data.valid,
383 'premium': data.premium,
384 'trafficleft': trafficleft,
385 'validuntil': validuntil,
386 'limitdl': limitdl,
387 'time': _time})
388
389 return render_to_response('settings.html',
390 {'conf': {'plugin': plugin_menu, 'general': conf_menu, 'accs': accs}, 'types': PYLOAD.getAccountTypes()},

Callers

nothing calls this directly

Calls 9

formatSizeFunction · 0.90
render_to_responseFunction · 0.90
_Function · 0.50
getConfigMethod · 0.45
getPluginConfigMethod · 0.45
keysMethod · 0.45
appendMethod · 0.45
getAccountsMethod · 0.45
getAccountTypesMethod · 0.45

Tested by

no test coverage detected