Index: config.py ================================================================== --- config.py +++ config.py @@ -123,10 +123,11 @@ self.__dict__[opt["name"]] = opt["value"] # plugin state if module and module not in conf.plugins: conf.plugins[module] = 1 + #@TODO: use meta["priority"] in ("core", "builtin", "default") etc. # http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html def xdg(self, path="/streamtuner2"): @@ -187,11 +188,11 @@ # decode r = json.load(f) f.close() return r except Exception as e: - print(dbg.ERR, "JSON parsing error (in "+name+")", e) + __print__(dbg.ERR, "JSON parsing error (in "+name+")", e) # recursive dict update def update(self, with_new_data): for key,value in with_new_data.items(): @@ -303,11 +304,11 @@ """, re.M|re.X) config = re.compile(r""" [\{\<] (.+?) [\}\>] # JSOL/YAML scheme {...} dicts """, re.X) options = re.compile(r""" - ["':$]? (\w+) ["']? # key or ":key" or '$key' + ["':$]? (\w*) ["']? # key or ":key" or '$key' \s* [:=] \s* # "=" or ":" (?: " ([^"]*) " | ' ([^']*) ' # "quoted" or 'singl' values | ([^,]*) # or unquoted literals ) @@ -316,11 +317,11 @@ # wrapper for all print statements def __print__(*args): - if "debug" in conf: + if "debug" in conf and conf.debug: print(" ".join([str(a) for a in args])) # error colorization dbg = type('obj', (object,), {