X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Futils%2Fconfig.py;h=b3a8d46a8c0c9a4d94ed001295226e631eecf61e;hb=dd235fa1ab3713bcd7d31ff5e5680cbb056244a0;hp=cdaefd198022a23bf71d54300383dd80623a1937;hpb=8bf0d37a99b80af5674a639bfbc155db18ac557d;p=mpd-sima.git diff --git a/sima/utils/config.py b/sima/utils/config.py index cdaefd1..b3a8d46 100644 --- a/sima/utils/config.py +++ b/sima/utils/config.py @@ -25,6 +25,7 @@ Parse configuration file and set defaults for missing options. # IMPORTS import configparser +import logging import sys from configparser import Error @@ -105,8 +106,8 @@ class ConfMan(object): # CONFIG MANAGER CLASS * command line options (overrides previous) """ - def __init__(self, logger, options=None): - self.log = logger + def __init__(self, options=None): + self.log = logging.getLogger('sima') # options settings priority: # defauts < env. var. < conf. file < command line self.conf_file = options.get('conf_file') @@ -119,20 +120,8 @@ class ConfMan(object): # CONFIG MANAGER CLASS ## INIT CALLS self.init_config() self.supersedes_config_with_cmd_line_options() - - def get_pw(self): - try: - self.config.getboolean('MPD', 'password') - self.log.debug('No password set, proceeding without ' + - 'authentication...') - return None - except ValueError: - # ValueError if password not a boolean, hence an actual password. - pwd = self.config.get('MPD', 'password') - if not pwd: - self.log.debug('Password set as an empty string.') - return None - return pwd + # generate dbfile + self.config['sima']['db_file'] = join(self.config['sima']['var_dir'], 'sima.db') def control_mod(self): """ @@ -208,7 +197,6 @@ class ConfMan(object): # CONFIG MANAGER CLASS ## Sima sqlite DB self.config['sima']['var_dir'] = join(data_dir) - self.config['sima']['db_file'] = join(data_dir, 'sima.db') # If no conf file present, uses defaults if not isfile(self.conf_file):