summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--icons/logo-gui.pngbin0 -> 8093 bytes
-rw-r--r--module/ConfigParser.py8
-rw-r--r--module/HookManager.py4
-rw-r--r--module/plugins/hooks/UpdateManager.py62
-rwxr-xr-xpyLoadCore.py1
5 files changed, 41 insertions, 34 deletions
diff --git a/icons/logo-gui.png b/icons/logo-gui.png
new file mode 100644
index 000000000..5994b274d
--- /dev/null
+++ b/icons/logo-gui.png
Binary files differ
diff --git a/module/ConfigParser.py b/module/ConfigParser.py
index c4a507689..d5f753b9b 100644
--- a/module/ConfigParser.py
+++ b/module/ConfigParser.py
@@ -208,12 +208,12 @@ class ConfigParser:
if dest[section].has_key(option):
dest[section][option]["value"] = config[section][option]["value"]
- else:
- dest[section][option] = config[section][option]
+ #else:
+ # dest[section][option] = config[section][option]
- else:
- dest[section] = config[section]
+ #else:
+ # dest[section] = config[section]
#----------------------------------------------------------------------
def saveConfig(self, config, filename):
diff --git a/module/HookManager.py b/module/HookManager.py
index 8bb8d1d5b..c4e8c28a2 100644
--- a/module/HookManager.py
+++ b/module/HookManager.py
@@ -74,9 +74,9 @@ class HookManager():
def periodical(self):
for plugin in self.plugins:
if plugin.isActivated() and plugin.lastCall + plugin.interval < time():
- plugin.periodical()
plugin.lastCall = time()
-
+ plugin.periodical()
+
@try_catch
def coreReady(self):
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index f8e65c017..02ba6a6ff 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -17,6 +17,7 @@
@author: RaNaN
@interface-version: 0.1
"""
+from os.path import join
from module.network.Request import getURL
from module.plugins.Hook import Hook
@@ -34,17 +35,14 @@ class UpdateManager(Hook):
self.interval = self.getConfig("interval") * 60
self.updated = False
- def coreReady(self):
- #@TODO check plugins, restart, and other stuff
- pass
-
def periodical(self):
update = self.checkForUpdate()
- if self.updated:
- self.log.info(_("*** Plugins were updated, please restart pyLoad ***"))
if not update:
self.checkPlugins()
-
+ if self.updated:
+ self.log.info(_("*** Plugins have been updated, please restart pyLoad ***"))
+ else:
+ self.log.info(_("No plugin updates available"))
def checkForUpdate(self):
""" checks if an update is available"""
@@ -66,32 +64,42 @@ class UpdateManager(Hook):
def checkPlugins(self):
""" checks for plugins updates"""
- string = ""
-
- string += self.createUpdateList(self.core.pluginManager.crypterPlugins, "crypter")
- string += self.createUpdateList(self.core.pluginManager.hosterPlugins, "hoster")
- string += self.createUpdateList(self.core.pluginManager.containerPlugins, "container")
- string += self.createUpdateList(self.core.pluginManager.accountPlugins, "account")
- string += self.createUpdateList(self.core.pluginManager.hookPlugins, "hook")
- string += self.createUpdateList(self.core.pluginManager.captchaPlugins, "captcha")
-
try:
- updates = getURL("updateurl", post={"plugins": string})
+ updates = getURL("http://get.pyload.org/plugins/check/")
except:
self.log.warning(_("Plugins could not be updated"))
- updates = ""
+ return False
updates = updates.splitlines()
for plugin in updates:
- type, name, url = plugin.split("|")
- print type, name, url
- #@TODO save url content to disk
+ path, version = plugin.split(":")
+ prefix, name = path.split("/")
+
+ if name.endswith(".pyc"):
+ tmp_name = name[:name.find("_")]
+ else:
+ tmp_name = name.replace(".py", "")
+
+ if prefix.endswith("s"):
+ type = prefix[:-1]
+ else:
+ type = prefix
+
+ plugins = getattr(self.core.pluginManager, "%sPlugins" % type)
+
+ if plugins.has_key(tmp_name):
+ if float(plugins[tmp_name]["v"]) >= float(version):
+ continue
- def createUpdateList(self, plugins, type):
- """ create string list for update check """
- string = ""
- for name,plugin in plugins.iteritems():
- string += "%s|%s|%s\n" % (type, name, plugin["v"])
+ self.log.info(_("New version of %(type)s|%(name)s : %(version).2f") % {
+ "type": type,
+ "name": name,
+ "version": float(version)
+ })
- return string \ No newline at end of file
+ content = getURL("http://get.pyload.org/plugins/get/" + path)
+ f = open(join("userplugins", prefix, name), "wb")
+ f.write(content)
+ f.close()
+ self.updated = True \ No newline at end of file
diff --git a/pyLoadCore.py b/pyLoadCore.py
index dd4741d3e..a276d00eb 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -210,7 +210,6 @@ class Core(object):
if self.config['ssl']['activated']:
self.check_install("OpenSSL", _("OpenSSL for secure connection"), True)
- self.downloadSpeedLimit = int(self.config.get("general", "download_speed_limit"))
self.requestFactory = RequestFactory(self)