From 9ab155e95db32e03ca6438df12d38500f9d437f9 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 8 Feb 2010 13:04:21 +0100 Subject: fixed click'n'load, added youtube hd option --- module/XMLConfigParser.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'module/XMLConfigParser.py') diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py index 678338b41..8be2df048 100644 --- a/module/XMLConfigParser.py +++ b/module/XMLConfigParser.py @@ -131,11 +131,30 @@ class XMLConfigParser(): self._setAttributes(section, data) self.saveData() self.loadData() + + def remove(self, section, option): + root = self.root + for node in root.childNodes: + if node.nodeType == node.ELEMENT_NODE: + if section == node.tagName: + for opt in node.childNodes: + if opt.nodeType == opt.ELEMENT_NODE: + if option == opt.tagName: + node.removeChild(opt) + self.saveData() + return + def _setAttributes(self, node, data): option = self.root.getElementsByTagName(node)[0].getElementsByTagName(data["option"])[0] - option.setAttribute("name", data["name"]) - option.setAttribute("type", data["type"]) + try: + option.setAttribute("name", data["name"]) + except: + pass + try: + option.setAttribute("type", data["type"]) + except: + pass try: option.setAttribute("input", data["input"]) except: -- cgit v1.2.3