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

Function downloads

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

Source from the content-addressed store, hash-verified

277@route("/downloads")
278@login_required('DOWNLOAD')
279def downloads():
280 root = PYLOAD.getConfigValue("general", "download_folder")
281
282 if not isdir(root):
283 return base([_('Download directory not found.')])
284 data = {
285 'folder': [],
286 'files': []
287 }
288
289 items = listdir(fs_encode(root))
290
291 for item in sorted([fs_decode(x) for x in items]):
292 if isdir(save_join(root, item)):
293 folder = {
294 'name': item,
295 'path': item,
296 'files': []
297 }
298 files = listdir(save_join(root, item))
299 for file in sorted([fs_decode(x) for x in files]):
300 try:
301 if isfile(save_join(root, item, file)):
302 folder['files'].append(file)
303 except:
304 pass
305
306 data['folder'].append(folder)
307 elif isfile(join(root, item)):
308 data['files'].append(item)
309
310 return render_to_response('downloads.html', {'files': data}, [pre_processor])
311
312
313@route("/downloads/get/<path:re:.+>")

Callers

nothing calls this directly

Calls 7

fs_encodeFunction · 0.90
save_joinFunction · 0.90
render_to_responseFunction · 0.90
baseFunction · 0.85
_Function · 0.50
getConfigValueMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected