diff options
-rw-r--r-- | module/ConfigParser.py | 63 | ||||
-rw-r--r-- | module/plugins/Crypter.py | 2 | ||||
-rwxr-xr-x | pyLoadCli.py | 4 |
3 files changed, 37 insertions, 32 deletions
diff --git a/module/ConfigParser.py b/module/ConfigParser.py index a7526fd17..c4a507689 100644 --- a/module/ConfigParser.py +++ b/module/ConfigParser.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import with_statement -from pprint import pprint +from time import sleep from os.path import exists from os.path import join from shutil import copy @@ -47,37 +47,42 @@ class ConfigParser: self.readConfig() #---------------------------------------------------------------------- - def checkVersion(self): + def checkVersion(self, n=0): """determines if config need to be copied""" - - if not exists("pyload.conf"): - copy(join(pypath,"module", "config", "default.conf"), "pyload.conf") + try: + if not exists("pyload.conf"): + copy(join(pypath,"module", "config", "default.conf"), "pyload.conf") + + if not exists("plugin.conf"): + f = open("plugin.conf", "wb") + f.write("version: "+str(CONF_VERSION)) + f.close() - if not exists("plugin.conf"): - f = open("plugin.conf", "wb") - f.write("version: "+str(CONF_VERSION)) - f.close() - - f = open("pyload.conf", "rb") - v = f.readline() - f.close() - v = v[v.find(":")+1:].strip() - - if int(v) < CONF_VERSION: - copy(join(pypath,"module", "config", "default.conf"), "pyload.conf") - print "Old version of config was replaced" - - f = open("plugin.conf", "rb") - v = f.readline() - f.close() - v = v[v.find(":")+1:].strip() - - if int(v) < CONF_VERSION: - f = open("plugin.conf", "wb") - f.write("version: "+str(CONF_VERSION)) + f = open("pyload.conf", "rb") + v = f.readline() f.close() - print "Old version of config was replaced" + v = v[v.find(":")+1:].strip() + if int(v) < CONF_VERSION: + copy(join(pypath,"module", "config", "default.conf"), "pyload.conf") + print "Old version of config was replaced" + + f = open("plugin.conf", "rb") + v = f.readline() + f.close() + v = v[v.find(":")+1:].strip() + + if int(v) < CONF_VERSION: + f = open("plugin.conf", "wb") + f.write("version: "+str(CONF_VERSION)) + f.close() + print "Old version of config was replaced" + except: + if n < 3: + sleep(0.3) + self.checkVersion(n+1) + else: + raise #---------------------------------------------------------------------- def readConfig(self): @@ -354,6 +359,6 @@ if __name__ == "__main__": print "sec", b-a - pprint(c.config) + print c.config c.saveConfig(c.config, "user.conf") diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index 2b0ba1460..c72babb15 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -54,5 +54,5 @@ class Crypter(Plugin): self.log.info(_("Parsed package %s with %s links") % (pack[0], len(pack[1]) ) ) - self.core.server_methods.add_package(pack[0], pack[1]) + self.core.server_methods.add_package(pack[0], pack[1], 1) diff --git a/pyLoadCli.py b/pyLoadCli.py index 4e97489c8..a9731c9b5 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -142,10 +142,10 @@ class pyLoadCli: line += 1 self.println(line, blue("[") + yellow(z * "#" + (25-z) * " ") + blue("] ") + green(conv(percent) + "%") + _(" Speed: ") + green(conv(int(download['speed'])) + " kb/s") + _(" Size: ") + green(download['format_size']) + _(" Finished in: ") + green(download['format_eta']) + _(" ID: ") + green(conv(download['id']))) line += 1 - if download["status"] == "waiting": + if download["status"] == 5: self.println(line, cyan(download["name"])) line += 1 - self.println(line, _("waiting: ") + green(self.format_time(download["wait_until"]- time.time()))) + self.println(line, _("waiting: ") + green(download["format_wait"]) ) line += 1 self.println(line, "") line += 1 |