summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-03-01 19:47:27 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-03-01 19:47:27 +0100
commite4b1bc88a1e0fc88a8769860a32ccd342e278fb1 (patch)
tree8f00997a74e44808227fd73d47b71c4f6fa298b3
parentwebinterface improvments + server crash fix (diff)
downloadpyload-e4b1bc88a1e0fc88a8769860a32ccd342e278fb1.tar.xz
webif. icons, storage.to fix
-rw-r--r--module/plugins/hoster/StorageTo.py14
-rw-r--r--module/web/ServerThread.py1
-rw-r--r--module/web/media/default/css/default.css5
-rw-r--r--module/web/media/default/img/reconnect.pngbin0 -> 755 bytes
-rw-r--r--module/web/templates/default/base.html21
-rwxr-xr-xpyLoadCore.py45
6 files changed, 59 insertions, 27 deletions
diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py
index dbff844ad..a9b1ec4c2 100644
--- a/module/plugins/hoster/StorageTo.py
+++ b/module/plugins/hoster/StorageTo.py
@@ -48,7 +48,12 @@ class StorageTo(Plugin):
pyfile.status.waituntil = self.time_plus_wait
pyfile.status.want_reconnect = self.want_reconnect
- thread.wait(self.parent)
+ while self.want_reconnect:
+ thread.wait(self.parent)
+ self.download_api_data()
+ self.get_wait_time()
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.want_reconnect = self.want_reconnect
pyfile.status.url = self.get_file_url()
@@ -73,7 +78,10 @@ class StorageTo(Plugin):
self.download_api_data()
if self.api_data["state"] == "wait":
self.want_reconnect = True
- self.time_plus_wait = time() + int(self.api_data["countdown"])
+ else:
+ self.want_reconnect = False
+
+ self.time_plus_wait = time() + int(self.api_data["countdown"]) + 3
@@ -98,7 +106,7 @@ class StorageTo(Plugin):
if not self.html:
self.download_html()
file_name_pattern = r"<span class=\"orange\">Downloading:</span>(.*?)<span class=\"light\">(.*?)</span>"
- return re.search(file_name_pattern, self.html).group(1)
+ return re.search(file_name_pattern, self.html).group(1).strip()
def proceed(self, url, location):
self.req.download(url, location, cookies=True)
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py
index 7efcc0b75..ffd6a2d35 100644
--- a/module/web/ServerThread.py
+++ b/module/web/ServerThread.py
@@ -7,7 +7,6 @@ from subprocess import Popen
from subprocess import call
from sys import version_info
import threading
-from time import sleep
class WebServer(threading.Thread):
def __init__(self, pycore):
diff --git a/module/web/media/default/css/default.css b/module/web/media/default/css/default.css
index 986e9a4bc..24bb9febf 100644
--- a/module/web/media/default/css/default.css
+++ b/module/web/media/default/css/default.css
@@ -968,7 +968,7 @@ a.urlextern {
background:transparent url(/media/default/img/external-10.2.png) no-repeat scroll right center;
padding:0 13px 0 0;
}
-a[href^="http://www.pyload.org"]:after, a.noextlink:after {
+a[href="http://www.pyload.org"]:after, a.noextlink:after {
background:none;
padding:0;
}
@@ -1008,6 +1008,9 @@ a.play {
a.time {
background:transparent url(/media/default/img/status_None.png) 0px 1px no-repeat;
}
+a.reconnect {
+ background:transparent url(/media/default/img/reconnect.png) 0px 1px no-repeat;
+}
a.play:hover {
background:transparent url(/media/default/img/control_play_blue.png) 0px 1px no-repeat;
}
diff --git a/module/web/media/default/img/reconnect.png b/module/web/media/default/img/reconnect.png
new file mode 100644
index 000000000..49b269145
--- /dev/null
+++ b/module/web/media/default/img/reconnect.png
Binary files differ
diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html
index 82581da45..27a50a018 100644
--- a/module/web/templates/default/base.html
+++ b/module/web/templates/default/base.html
@@ -76,6 +76,24 @@ function LoadJsonToContent(data)
$("speed").set('text', Math.round(data.speed*100)/100);
$("aktiv").set('text', data.activ);
$("aktiv_from").set('text', data.queue);
+
+ if (data.download) {
+ $("time").set('text', " {% trans "on" %}");
+ $("time").setStyle('background-color', "#8ffc25");
+
+ }else{
+ $("time").set('text', " {% trans "off" %}");
+ $("time").setStyle('background-color', "#fc6e26");
+ }
+
+ if (data.reconnect){
+ $("reconnect").set('text', " {% trans "on" %}");
+ $("reconnect").setStyle('background-color', "#8ffc25");
+ }
+ else{
+ $("reconnect").set('text', " {% trans "off" %}");
+ $("reconnect").setStyle('background-color', "#fc6e26");
+ }
}
function show(){
add_bg.set('opacity', 0);
@@ -180,7 +198,8 @@ function AddBox()
{% if perms.pyload.can_see_dl %}
<ul id="page-actions">
- <li><a class="time">{% trans "Download:" %}<a style=" background-color: #7CFC00; padding-left: 0cm; padding-right: 0.1cm; "> {% trans "on" %}</a></a></li>
+ <li><a class="time">{% trans "Download:" %}<a id="time" style=" background-color: {% if status.download %}#8ffc25{% else %} #fc6e26{% endif %}; padding-left: 0cm; padding-right: 0.1cm; "> {% if status.download %}{% trans "on" %}{% else %}{% trans "off" %}{% endif %}</a></a></li>
+ <li><a class="reconnect">{% trans "Reconnect:" %}<a id="reconnect" style=" background-color: {% if status.reconnect %}#8ffc25{% else %} #fc6e26{% endif %}; padding-left: 0cm; padding-right: 0.1cm; "> {% if status.reconnect %}{% trans "on" %}{% else %}{% trans "off" %}{% endif %}</a></a></li>
<li><a class="action backlink">{% trans "Speed:" %} <b id="speed">{{ status.speed }}</b> kb/s</a></li>
<li><a class="action cog">{% trans "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">{% trans "Reload page" %}</a></li>
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 0459751cf..5a222c0d3 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -358,28 +358,31 @@ class Core(object):
self.last_update_check = time.time()
def install_update(self):
- if self.config['updates']['search_updates']:
- if self.core.config['updates']['install_updates']:
- version_check = Request().load("http://get.pyload.org/get/update/%s/" % (CURRENT_VERSION, ))
- else:
- version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION, ))
- if version_check == "":
- return False
- else:
- if self.config['updates']['install_updates']:
- try:
- tmp_zip_name = __import__("tempfile").NamedTemporaryFile(suffix=".zip").name
- tmp_zip = open(tmp_zip_name, 'wb')
- tmp_zip.write(version_check)
- tmp_zip.close()
- __import__("module.Unzip", globals(), locals(), "Unzip", -1).Unzip().extract(tmp_zip_name, "Test/")
- return True
- except:
- self.logger.info(_("Auto install Failed"))
- return False
+ try:
+ if self.config['updates']['search_updates']:
+ if self.core.config['updates']['install_updates']:
+ version_check = Request().load("http://get.pyload.org/get/update/%s/" % (CURRENT_VERSION, ))
else:
+ version_check = Request().load("http://get.pyload.org/check/%s/" % (CURRENT_VERSION, ))
+ if version_check == "":
return False
- else:
+ else:
+ if self.config['updates']['install_updates']:
+ try:
+ tmp_zip_name = __import__("tempfile").NamedTemporaryFile(suffix=".zip").name
+ tmp_zip = open(tmp_zip_name, 'wb')
+ tmp_zip.write(version_check)
+ tmp_zip.close()
+ __import__("module.Unzip", globals(), locals(), "Unzip", -1).Unzip().extract(tmp_zip_name, "Test/")
+ return True
+ except:
+ self.logger.info(_("Auto install Failed"))
+ return False
+ else:
+ return False
+ else:
+ return False
+ finally:
return False
def make_path(self, * args):
@@ -443,7 +446,7 @@ class ServerMethods():
for pyfile in self.core.thread_list.py_downloading:
status['speed'] += pyfile.status.get_speed()
- status['download'] = self.core.thread_list.pause and self.is_time_download()
+ status['download'] = not self.core.thread_list.pause and self.is_time_download()
status['reconnect'] = self.core.config['reconnect']['activated'] and self.is_time_reconnect()
return status