Skip to content

Commit 07f280a

Browse files
committed
queue page fully functional, some fixes
1 parent 631c011 commit 07f280a

17 files changed

Lines changed: 165 additions & 25 deletions

‎module/file_list.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def getFileInfo(self, id):
167167
info["status_url"] = pyfile.status.url
168168
info["status_filename"] = pyfile.status.filename
169169
info["status_error"] = pyfile.status.error
170+
info["size"] = pyfile.status.size()
170171
info["active"] = pyfile.active
171172
info["plugin"] = pyfile.plugin.props['name']
172173
return info

‎module/web/ajax/urls.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# Uncomment the next line to enable the admin:
1414
(r'^add_package$', 'views.add_package'),
15-
(r'^remove_link/(\d+)$', 'views.remove_link'),
15+
(r'^abort_link/(\d+)$', 'views.abort_link'),
1616
(r'^status$', 'views.status'),
1717
(r'^links$', 'views.links'), #currently active links
1818
(r'^queue$', 'views.queue'),
@@ -22,4 +22,8 @@
2222
(r'^packages$', 'views.packages'),
2323
(r'^package/(\d+)$', 'views.package'),
2424
(r'^link/(\d+)$', 'views.link'),
25+
(r'^remove_package/(\d+)$', 'views.remove_package'),
26+
(r'^restart_package/(\d+)$', 'views.restart_package'),
27+
(r'^remove_link/(\d+)$', 'views.remove_link'),
28+
(r'^restart_link/(\d+)$', 'views.restart_link'),
2529
)

‎module/web/ajax/views.py‎

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ def add_package(request):
3939

4040
name = request.POST['add_name']
4141

42-
if name == None or name == "":
43-
return HttpResponseServerError()
44-
4542
links = request.POST['add_links'].replace(" ","\n").split("\n")
4643

4744
try:
4845
f = request.FILES['add_file']
49-
print f
46+
47+
if name == None or name == "":
48+
name = f.name
49+
5050
fpath = join(settings.DL_ROOT, f.name)
51-
print fpath
5251
destination = open(fpath, 'wb')
5352
for chunk in f.chunks():
5453
destination.write(chunk)
@@ -57,6 +56,9 @@ def add_package(request):
5756
except:
5857
pass
5958

59+
if name == None or name == "":
60+
return HttpResponseServerError()
61+
6062
links = filter(lambda x: x != "", links)
6163

6264
settings.PYLOAD.add_package(name, links)
@@ -160,3 +162,35 @@ def link(request, id):
160162

161163
except:
162164
return HttpResponseServerError()
165+
166+
@permission('pyload.can_add_dl')
167+
def remove_package(request, id):
168+
try:
169+
settings.PYLOAD.del_packages([int(id)])
170+
return JsonResponse("sucess")
171+
except:
172+
return HttpResponseServerError()
173+
174+
@permission('pyload.can_add_dl')
175+
def restart_package(request, id):
176+
try:
177+
settings.PYLOAD.restart_package(int(id))
178+
return JsonResponse("sucess")
179+
except:
180+
return HttpResponseServerError()
181+
182+
@permission('pyload.can_add_dl')
183+
def restart_link(request, id):
184+
try:
185+
settings.PYLOAD.restart_file(int(id))
186+
return JsonResponse("sucess")
187+
except:
188+
return HttpResponseServerError()
189+
190+
@permission('pyload.can_add_dl')
191+
def abort_link(request, id):
192+
try:
193+
settings.PYLOAD.stop_download("link", int(id))
194+
return JsonResponse("sucess")
195+
except:
196+
return HttpResponseServerError()

‎module/web/media/default/css/default.css‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ div.codearea pre span.Preprc {
14661466
padding-right: 8px;
14671467
}
14681468
.package {
1469-
margin-bottom: 20px;
1469+
margin-bottom: 10px;
14701470
}
14711471
.packagename {
14721472
background: url(/media/default/img/folder.png) no-repeat;
@@ -1495,3 +1495,16 @@ div.codearea pre span.Preprc {
14951495
height: 5px;
14961496

14971497
}
1498+
1499+
.queue {
1500+
border: none
1501+
}
1502+
1503+
.queue tr td {
1504+
border: none
1505+
}
1506+
1507+
.header, .header th{
1508+
text-align: left;
1509+
font-weight: normal;
1510+
}
-10.6 KB
Binary file not shown.
-10.6 KB
Binary file not shown.
-120 Bytes
Binary file not shown.
-1.59 KB
Binary file not shown.
-1.28 KB
Binary file not shown.
-1.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)