aboutsummaryrefslogtreecommitdiffstats
path: root/IRC/getconf.py
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2013-12-16 16:23:12 +0100
committerlassulus <lassulus@googlemail.com>2013-12-16 16:23:12 +0100
commit2b271a1187bb19e464627f38fdb8caa7160eaf12 (patch)
tree2621af35eb4df086750d8f03f1e84af8fc39d581 /IRC/getconf.py
parentb88195721f6e315c6bc029a6936ba91e4733edd8 (diff)
Reaktor/IRC: use config.json (and python3ize)
Diffstat (limited to 'IRC/getconf.py')
-rw-r--r--IRC/getconf.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/IRC/getconf.py b/IRC/getconf.py
new file mode 100644
index 0000000..5fdd1cd
--- /dev/null
+++ b/IRC/getconf.py
@@ -0,0 +1,20 @@
+#getconf = make_getconf("dateiname.json")
+#getconf(key) -> value
+#oder error
+
+import json
+
+def make_getconf(filename):
+ def getconf(prop):
+ prop_split = prop.split('.')
+ string = ''
+ file = open(filename)
+ for line in file.readlines():
+ string+=line
+ parsed = json.loads(string)
+ tmp = parsed
+ for pr in prop_split:
+ tmp = tmp[pr]
+
+ return tmp
+ return getconf