summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-21 21:14:30 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-21 21:14:30 +0200
commit03a12260603d081e1bc089d09804bbca960ba751 (patch)
tree79c1bac3dbb8ea77f4186f3b1477858bb8d12da8 /module
parentremoved tempfile, win fixes (diff)
downloadpyload-03a12260603d081e1bc089d09804bbca960ba751.tar.xz
fixes
Diffstat (limited to 'module')
-rw-r--r--module/ConfigParser.py63
-rw-r--r--module/plugins/Crypter.py2
2 files changed, 35 insertions, 30 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)