summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-26 21:17:45 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-26 21:17:45 +0100
commit15841561a8e5650d88e4af477b8e4f8f96a81253 (patch)
treed1cbee2d936ed90fdf99df90b1bcec9b31e58257
parentfixed view update (diff)
downloadpyload-15841561a8e5650d88e4af477b8e4f8f96a81253.tar.xz
pluginconfig now in xml
-rw-r--r--.hgignore2
-rw-r--r--icons/gui/refresh_small.pngbin0 -> 821 bytes
-rw-r--r--icons/gui/remove_small.pngbin0 -> 287 bytes
-rw-r--r--module/Plugin.py23
-rw-r--r--module/XMLConfigParser.py5
-rw-r--r--module/config/plugin_default.xml39
-rw-r--r--pluginconfig29
7 files changed, 57 insertions, 41 deletions
diff --git a/.hgignore b/.hgignore
index 1af47aa3b..10afb8d80 100644
--- a/.hgignore
+++ b/.hgignore
@@ -14,6 +14,7 @@ Plugins/DLC.py
failed_links.txt
module/config/gui.xml
module/config/core.xml
+module/config/plugin.xml
links.txt
module/links.pkl
module/cookies.txt
@@ -21,3 +22,4 @@ ssl.crt
ssl.key
cert.pem
module/web/pyload.db
+webserver.pid
diff --git a/icons/gui/refresh_small.png b/icons/gui/refresh_small.png
new file mode 100644
index 000000000..1ffd18d97
--- /dev/null
+++ b/icons/gui/refresh_small.png
Binary files differ
diff --git a/icons/gui/remove_small.png b/icons/gui/remove_small.png
new file mode 100644
index 000000000..bf99763e8
--- /dev/null
+++ b/icons/gui/remove_small.png
Binary files differ
diff --git a/module/Plugin.py b/module/Plugin.py
index 7e6ca4e35..9390cbe07 100644
--- a/module/Plugin.py
+++ b/module/Plugin.py
@@ -20,15 +20,16 @@
import ConfigParser
import logging
import re
-from os.path import exists
+from os.path import exists, join
from module.network.Request import Request
+from module.XMLConfigParser import XMLConfigParser
class Plugin():
def __init__(self, parent):
- self.parser = ConfigParser.SafeConfigParser()
+ self.configparser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml"))
self.config = {}
props = {}
props['name'] = "BasePlugin"
@@ -112,19 +113,19 @@ class Plugin():
self.req.download(url, location)
def set_config(self):
- pass
+ for k, v in self.config:
+ self.configparser.set(self.props['name'], k, v)
def get_config(self, value):
- self.parser.read("pluginconfig")
- return self.parser.get(self.props['name'], value)
+ self.configparser.loadData()
+ return self.configparser.get(self.props['name'], value)
def read_config(self):
- self.parser.read("pluginconfig")
-
- if self.parser.has_section(self.props['name']):
- for option in self.parser.options(self.props['name']):
- self.config[option] = self.parser.get(self.props['name'], option, raw=True)
- self.config[option] = False if self.config[option].lower() == 'false' else self.config[option]
+ self.configparser.loadData()
+ try:
+ self.config = self.configparser.getConfig()[self.props['name']]
+ except:
+ pass
def init_ocr(self):
modul = __import__("module.captcha." + self.props['name'], fromlist=['captcha'])
diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py
index 51741fdfd..eedc00b67 100644
--- a/module/XMLConfigParser.py
+++ b/module/XMLConfigParser.py
@@ -59,7 +59,10 @@ class XMLConfigParser():
config[section] = {}
for opt in node.childNodes:
if opt.nodeType == opt.ELEMENT_NODE:
- config[section][opt.tagName] = format(opt.firstChild.data)
+ try:
+ config[section][opt.tagName] = format(opt.firstChild.data)
+ except:
+ config[section][opt.tagName] = ""
self.config = config
def get(self, section, option, default=None):
diff --git a/module/config/plugin_default.xml b/module/config/plugin_default.xml
new file mode 100644
index 000000000..01c0e7ed6
--- /dev/null
+++ b/module/config/plugin_default.xml
@@ -0,0 +1,39 @@
+<config>
+ <RapidshareCom>
+ <!-- possible:
+ Cogent, Deutsche Telekom,
+ Level(3), Level(3) #2,
+ GlobalCrossing, Level(3) #3,
+ Teleglobe, GlobalCrossing #2,
+ TeliaSonera #2, Teleglobe #2,
+ TeliaSonera #3, TeliaSonera
+ -->
+ <!-- leave empty for autmomatic selection -->
+ <server></server>
+ <premium>False</premium>
+ <username></username>
+ <password></password>
+ </RapidshareCom>
+ <NetloadIn>
+ <premium>False</premium>
+ <username></username>
+ <password></password>
+ </NetloadIn>
+ <UploadedTo>
+ <premium>False</premium>
+ <username></username>
+ <password></password>
+ </UploadedTo>
+ <ShareonlineBiz>
+ <premium>False</premium>
+ <username></username>
+ <password></password>
+ </ShareonlineBiz>
+ <YoutubeCom>
+ <high_quality>True</high_quality>
+ </YoutubeCom>
+ <YoutubeChannel>
+ <!-- False for no limitation -->
+ <max_videos>False</max_videos>
+ </YoutubeChannel>
+</config>
diff --git a/pluginconfig b/pluginconfig
deleted file mode 100644
index c0fdd3d10..000000000
--- a/pluginconfig
+++ /dev/null
@@ -1,29 +0,0 @@
-[RapidshareCom]
-#select server, empty for automatic, else Cogent, Deutsche Telekom, Level(3), Level(3) #2, GlobalCrossing, Level(3) #3, Teleglobe, GlobalCrossing #2, TeliaSonera #2, Teleglobe #2, TeliaSonera #3, TeliaSonera
-server = ""
-premium = False
-username = namehere
-password = passhere
-
-[NetloadIn]
-premium = False
-username = namehere
-password = passhere
-
-[UploadedTo]
-premium = False
-username = namehere
-password = passhere
-
-[ShareonlineBiz]
-premium = False
-username = namehere
-password = passhere
-
-[YoutubeCom]
-high_quality = True
-
-[YoutubeChannel]
-#type False for no limitation
-max_videos = False
-