- self.log.info('Env. variable MPD_PORT set to "%s".'
- % mpd_port)
- self.defaults['MPD']['port'] = mpd_port
-
- def control_conf(self):
- """Get through options/values and set defaults if not in conf file."""
- # Control presence of obsolete settings
- for option in ['history', 'history_length', 'top_tracks']:
- if self.config.has_option('sima', option):
- self.log.warning('Obsolete setting found in conf file: "%s"'
- % option)
- # Setting default if not specified
- for section in DEFAULT_CONF.keys():
- if section not in self.config.sections():
- self.log.debug('[%s] NOT in conf file' % section)
- self.config.add_section(section)
- for option in self.defaults[section]:
- self.config.set(section,
- option,
- self.defaults[section][option])
- self.log.debug(
- 'Setting option with default value: %s = %s' %
- (option, self.defaults[section][option]))
- elif section in self.config.sections():
- self.log.debug('[%s] present in conf file' % section)
- for option in self.defaults[section]:
- if self.config.has_option(section, option):
- #self.log.debug(u'option "%s" set to "%s" in conf. file' %
- # (option, self.config.get(section, option)))
- pass
- else:
- self.log.debug(
- 'Option "%s" missing in section "%s"' %
- (option, section))
- self.log.debug('=> setting default "%s" (may not suit you…)' %
- self.defaults[section][option])
- self.config.set(section, option,
- self.defaults[section][option])