diff options
Diffstat (limited to 'module/web/ajax/views.py')
-rw-r--r-- | module/web/ajax/views.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index 05c91597f..584ad1a0e 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -78,3 +78,42 @@ def unpause(request): except: return HttpResponseServerError() + + + +@permission('pyload.can_see_dl') +def packages(request): + try: + data = settings.PYLOAD.get_queue() + + for package in data: + package['links'] = [] + for file in settings.PYLOAD.get_package_files(package['id']): + package['links'].append(settings.PYLOAD.get_file_info(file)) + + return JsonResponse(data) + + except: + return HttpResponseServerError() + +@permission('pyload.can_see_dl') +def package(request,id): + try: + data = settings.PYLOAD.get_package_data(int(id)) + data['links'] = [] + for file in settings.PYLOAD.get_package_files(data['id']): + data['links'].append(settings.PYLOAD.get_file_info(file)) + + return JsonResponse(data) + + except: + return HttpResponseServerError() + +@permission('pyload.can_see_dl') +def link(request,id): + try: + data = settings.PYLOAD.get_file_info(int(id)) + return JsonResponse(data) + + except: + return HttpResponseServerError() |