# IMPORTS
import configparser
+import logging
import sys
from configparser import Error
'verbosity': "info",
'logfile': "",
},
+ 'crop': {
+ 'consume': 10,
+ },
'echonest': {
'queue_mode': "track", #TODO control values
'max_art': 15,
'track_to_add': 1,
'album_to_add': 1,
'depth': 1,
+ 'cache': True,
},
'randomfallback': {
'flavour': "sensible", # in pure, sensible
* 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')
## 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):
"""
## 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):