diff options
Diffstat (limited to 'module/web')
-rw-r--r-- | module/web/ajax/views.py | 10 | ||||
-rw-r--r-- | module/web/pyload/views.py | 8 | ||||
-rw-r--r-- | module/web/templates/default/home.html | 6 |
3 files changed, 15 insertions, 9 deletions
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index 558d35415..02c135bfe 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -107,10 +107,10 @@ def links(request): ids = [] for link in links: ids.append(link['id']) - print link['status'] - if link['status'] == 'downloading': + + if link['status'] == 12: link['info'] = "%s @ %s kb/s" % (format_time(link['eta']), round(link['speed'], 2)) - elif link['status'] == 'waiting': + elif link['status'] == 5: link['percent'] = 0 link['size'] = 0 link['kbleft'] = 0 @@ -211,7 +211,7 @@ def restart_package(request, id): try: settings.PYLOAD.restart_package(int(id)) return JsonResponse("sucess") - except: + except Exception: return HttpResponseServerError() @permission('pyload.can_add_dl') @@ -219,7 +219,7 @@ def restart_link(request, id): try: settings.PYLOAD.restart_file(int(id)) return JsonResponse("sucess") - except: + except Exception: return HttpResponseServerError() @permission('pyload.can_add_dl') diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 52b58cd03..67ac6c07a 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -67,7 +67,13 @@ def base(request, messages): @permission('pyload.can_see_dl') @check_server def home(request): - return render_to_response(join(settings.TEMPLATE, 'home.html'), RequestContext(request, {'content': settings.PYLOAD.status_downloads()}, [status_proc])) + res = settings.PYLOAD.status_downloads() + + for link in res: + if link["status"] == 12: + link["information"] = "%s kB @ %s kB/s" % (link["size"] - link["kbleft"], link["speed"]) + + return render_to_response(join(settings.TEMPLATE, 'home.html'), RequestContext(request, {'content': res}, [status_proc])) @login_required diff --git a/module/web/templates/default/home.html b/module/web/templates/default/home.html index f3d40b4e0..76f87b203 100644 --- a/module/web/templates/default/home.html +++ b/module/web/templates/default/home.html @@ -169,10 +169,10 @@ var LinkEntry = new Class({ },
update: function(item){
this.elements.name.set('text', item.name);
- this.elements.status.set('text', item.status);
+ this.elements.status.set('text', item.statusmsg);
this.elements.info.set('text', item.info);
- this.elements.kbleft.set('text', HumanFileSize(item.size));
- this.elements.percent.set('text', item.percent+ '% / '+ HumanFileSize(item.size-item.kbleft));
+ this.elements.kbleft.set('text', HumanFileSize(item.size / (1024)));
+ this.elements.percent.set('text', item.percent+ '% / '+ HumanFileSize((item.size-item.kbleft) / (1024)));
this.bar.start({
'width': item.percent,
'background-color': [Math.round(120/100*item.percent),100,100].hsbToRgb().rgbToHex()
|