diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-17 23:52:22 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-17 23:52:22 +0100 |
commit | a9a0ab594e4ea05532ff089b8eee7bf20ea571be (patch) | |
tree | 485937ee65c55ff4074fc9ca5b54152994567885 /module/web/ajax/views.py | |
parent | Removed prints (diff) | |
download | pyload-a9a0ab594e4ea05532ff089b8eee7bf20ea571be.tar.xz |
new web JSON functions
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() |