summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-07-29 20:08:07 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-07-29 20:08:07 +0200
commitff21df6b2ccdaf5161351ab69086d358a98c241d (patch)
treed958eeb0d78ee6eec38349ed2884bb33ae429e6f /module/web
parentmore improvements and cleaned some imports (diff)
downloadpyload-ff21df6b2ccdaf5161351ab69086d358a98c241d.tar.xz
restart working and client information
Diffstat (limited to 'module/web')
-rw-r--r--module/web/ajax/views.py10
-rw-r--r--module/web/pyload/views.py8
-rw-r--r--module/web/templates/default/home.html6
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()