diff options
Diffstat (limited to 'pyload/config/Parser.py')
-rw-r--r-- | pyload/config/Parser.py | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/pyload/config/Parser.py b/pyload/config/Parser.py index bad512a5f..ed81d041c 100644 --- a/pyload/config/Parser.py +++ b/pyload/config/Parser.py @@ -91,8 +91,8 @@ class ConfigParser(object): homeconf = self.parseConfig("pyload.conf") if "username" in homeconf["remote"]: if "password" in homeconf["remote"]: - self.oldRemoteData = {"username": homeconf["remote"]["username"]["value"], - "password": homeconf["remote"]["username"]["value"]} + self.oldRemoteData = {"username": homeconf["remote"]["username"]['value'], + "password": homeconf["remote"]["username"]['value']} del homeconf["remote"]["password"] del homeconf["remote"]["username"] self.updateValues(homeconf, self.config) @@ -159,7 +159,7 @@ class ConfigParser(object): typ, none, option = content.strip().rpartition(" ") value = value.strip() - typ = typ.strip() + typ = typ.strip() if value.startswith("["): if value.endswith("]"): @@ -195,7 +195,7 @@ class ConfigParser(object): continue if option in dest[section]: - dest[section][option]["value"] = config[section][option]["value"] + dest[section][option]['value'] = config[section][option]['value'] # else: # dest[section][option] = config[section][option] @@ -216,20 +216,20 @@ class ConfigParser(object): for option, data in config[section].iteritems(): if option in ("desc", "outline"): continue - if isinstance(data["value"], list): + if isinstance(data['value'], list): value = "[ \n" - for x in data["value"]: + for x in data['value']: value += "\t\t" + str(x) + ",\n" value += "\t\t]\n" else: - if isinstance(data["value"], basestring): - value = data["value"] + "\n" + if isinstance(data['value'], basestring): + value = data['value'] + "\n" else: - value = str(data["value"]) + "\n" + value = str(data['value']) + "\n" try: - f.write('\t%s %s : "%s" = %s' % (data["type"], option, data["desc"], value)) + f.write('\t%s %s : "%s" = %s' % (data['type'], option, data["desc"], value)) except UnicodeEncodeError: - f.write('\t%s %s : "%s" = %s' % (data["type"], option, data["desc"], encode(value))) + f.write('\t%s %s : "%s" = %s' % (data['type'], option, data["desc"], encode(value))) def cast(self, typ, value): @@ -266,33 +266,31 @@ class ConfigParser(object): def get(self, section, option): """get value""" - value = self.config[section][option]["value"] + value = self.config[section][option]['value'] return decode(value) def set(self, section, option, value): """set value""" - - value = self.cast(self.config[section][option]["type"], value) - - self.config[section][option]["value"] = value + value = self.cast(self.config[section][option]['type'], value) + self.config[section][option]['value'] = value self.save() def getPlugin(self, plugin, option): """gets a value for a plugin""" - value = self.plugin[plugin][option]["value"] + value = self.plugin[plugin][option]['value'] return encode(value) def setPlugin(self, plugin, option, value): """sets a value for a plugin""" - value = self.cast(self.plugin[plugin][option]["type"], value) + value = self.cast(self.plugin[plugin][option]['type'], value) if self.pluginCB: self.pluginCB(plugin, option, value) - self.plugin[plugin][option]["value"] = value + self.plugin[plugin][option]['value'] = value self.save() @@ -319,7 +317,7 @@ class ConfigParser(object): for item in config: if item[0] in conf: - conf[item[0]]["type"] = item[1] + conf[item[0]]['type'] = item[1] conf[item[0]]["desc"] = item[2] else: conf[item[0]] = { |