summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-01-17 18:31:52 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-01-17 18:31:52 +0100
commit8d842efb12ee7db88505e3078b626855e55aa4bf (patch)
tree54670c428b961f299ec10dd91255f8f17333f7d5
parentFixed Shareonline (diff)
downloadpyload-8d842efb12ee7db88505e3078b626855e55aa4bf.tar.xz
some fixes, closed #62 ??
-rw-r--r--module/thread_list.py5
-rw-r--r--module/web/ajax/urls.py1
-rw-r--r--module/web/ajax/views.py8
-rw-r--r--module/web/templates/default/base.html26
-rw-r--r--module/web/templates/default/queue.html13
-rwxr-xr-xpyLoadCore.py5
6 files changed, 49 insertions, 9 deletions
diff --git a/module/thread_list.py b/module/thread_list.py
index 55b21093f..e4952587c 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -201,7 +201,7 @@ class Thread_List(object):
def reconnect(self):
self.parent.logger.info("Start reconnect")
ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1)
- self.parent.hookManager.beforeReconnecting(ip)
+ #self.parent.hookManager.beforeReconnecting(ip)
reconn = subprocess.Popen(self.parent.config['activated']['method'])#, stdout=subprocess.PIPE)
reconn.wait()
time.sleep(1)
@@ -212,10 +212,11 @@ class Thread_List(object):
except:
ip = ""
time.sleep(1)
- self.parent.hookManager.afterReconnecting(ip)
+ #self.parent.hookManager.afterReconnecting(ip)
self.parent.logger.info("Reconnected, new IP: " + ip)
def stopAllDownloads(self):
+ self.pause = True
for pyfile in self.py_downloading:
pyfile.plugin.req.abort = True
diff --git a/module/web/ajax/urls.py b/module/web/ajax/urls.py
index 4decc27b1..7d63ef5a6 100644
--- a/module/web/ajax/urls.py
+++ b/module/web/ajax/urls.py
@@ -18,6 +18,7 @@ urlpatterns = patterns('ajax',
(r'^queue$', 'views.queue'),
(r'^pause$', 'views.pause'),
(r'^unpause$', 'views.unpause'),
+ (r'^cancel$', 'views.cancel'),
(r'^packages$', 'views.packages'),
(r'^package/(\d+)$', 'views.package'),
(r'^link/(\d+)$', 'views.link'),
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py
index ea092745f..4f136cef9 100644
--- a/module/web/ajax/views.py
+++ b/module/web/ajax/views.py
@@ -30,7 +30,7 @@ class JsonResponse(HttpResponse):
object, indent=2, cls=json.DjangoJSONEncoder,
ensure_ascii=False)
super(JsonResponse, self).__init__(
- content, content_type='application/json') #@TODO uncomment
+ content)#, content_type='application/json') #@TODO uncomment
self['Cache-Control'] = 'no-cache, must-revalidate'
@@ -117,6 +117,12 @@ def unpause(request):
return HttpResponseServerError()
+@permission('pyload.can_change_status')
+def cancel(request):
+ try:
+ return JsonResponse(settings.PYLOAD.stop_downloads())
+ except:
+ return HttpResponseServerError()
@permission('pyload.can_see_dl')
def packages(request):
diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html
index 0cebeb5d8..692a951bc 100644
--- a/module/web/templates/default/base.html
+++ b/module/web/templates/default/base.html
@@ -45,6 +45,20 @@ document.addEvent("domready", function(){
limit: 30000
})
+ $('action_play').addEvent('click', function(){
+ new Request({method: 'get', url: 'json/unpause'}).send();
+ });
+
+
+ $('action_cancel').addEvent('click', function(){
+ new Request({method: 'get', url: 'json/cancel'}).send();
+ });
+
+
+ $('action_stop').addEvent('click', function(){
+ new Request({method: 'get', url: 'json/pause'}).send();
+ });
+
jsonStatus.startTimer();
});
@@ -58,8 +72,8 @@ document.addEvent("domready", function(){
function LoadJsonToContent(data)
{
$("speed").set('text', Math.round(data.speed*100)/100);
- $("aktiv").set('text', data.queue);
- $("queue").set('text', data.total);
+ $("aktiv").set('text', data.activ);
+ $("aktiv_from").set('text', data.queue);
}
function show(){
add_bg.set('opacity', 0);
@@ -147,9 +161,9 @@ function AddBox()
{% if perms.pyload.can_change_status %}
<ul id="page-actions2">
- <li id="action_play"><a href="/json/unpause" class="action play" accesskey="o" rel="nofollow">Play</a></li>
- <li id="action_stop"><a href="" class="action cancel" accesskey="o" rel="nofollow">Cancel</a></li>
- <li id="action_stop"><a href="/json/pause" class="action stop" accesskey="o" rel="nofollow">Stop</a></li>
+ <li id="action_play"><a href="#" class="action play" accesskey="o" rel="nofollow">Play</a></li>
+ <li id="action_cancel"><a href="#" class="action cancel" accesskey="o" rel="nofollow">Cancel</a></li>
+ <li id="action_stop"><a href="#" class="action stop" accesskey="o" rel="nofollow">Stop</a></li>
<li id="action_add"><a href="javascript:AddBox();" class="action stop" accesskey="o" rel="nofollow" >Add</a></li>
</ul>
{% endif %}
@@ -157,7 +171,7 @@ function AddBox()
{% if perms.pyload.can_see_dl %}
<ul id="page-actions">
<li><a class="action backlink">Speed: <b id="speed">{{ status.speed }}</b> kb/s</a></li>
- <li><a class="action cog">Active: <b id="aktiv">{{ status.queue }}</b> / <b id="aktiv_from">{{ status.total }}</b></a></li>
+ <li><a class="action cog">Active: <b id="aktiv">{{ status.activ }}</b> / <b id="aktiv_from">{{ status.queue }}</b></a></li>
<li><a href="" class="action revisions" accesskey="o" rel="nofollow">Reload page</a></li>
</ul><br />
{% endif %}
diff --git a/module/web/templates/default/queue.html b/module/web/templates/default/queue.html
index e9c1baa92..bc306730e 100644
--- a/module/web/templates/default/queue.html
+++ b/module/web/templates/default/queue.html
@@ -28,4 +28,17 @@
</li>
{% endfor %}
<ul>
+
+
+<table >
+ <tr>
+ <td width=50%><h1>!Paketname!</h1></td>
+ </tr>
+ <tr>
+ <td width=100%><h2>test.png</h2></td>
+ <td width=100%>loading</td>
+ <td width=100%><a href="/"><img id="button" src="/img/button-delete.gif" alt="delete" /></a><a href="/"><img id="button" src="/img/button-unpause.gif" alt="unpause" /></a></td>
+ </tr>
+</table>
+
{% endblock %}
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 4b2e63a2c..96cd1b204 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -303,6 +303,11 @@ class Core(object):
self.logger.info(_("created index of plugins"))
def compare_time(self, start, end):
+
+ toInt = lambda x: int(x)
+ start = map(toInt, start)
+ end = map(toInt, end)
+
if start == end: return True
now = time.localtime()[3:5]