X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Futils%2Fconfig.py;h=99fb3227b7b69b18f085d513dcefcb99e608c67d;hb=00f3a52f35f709dd4c471cb6ad87dbd09cfd4aaf;hp=06765254da21b24e7d1765921ccfd7181494f2bb;hpb=c1bda032095902bdcd183c530a9c4de28f3c828a;p=mpd-sima.git diff --git a/sima/utils/config.py b/sima/utils/config.py index 0676525..99fb322 100644 --- a/sima/utils/config.py +++ b/sima/utils/config.py @@ -36,32 +36,49 @@ from stat import (S_IMODE, ST_MODE, S_IRWXO, S_IRWXG) from . import utils # DEFAULTS -DIRNAME = 'sima' +DIRNAME = 'mpd_sima' CONF_FILE = 'sima.cfg' DEFAULT_CONF = { 'MPD': { 'host': "localhost", - 'password': "false", - 'port': "6600"}, + #'password': "", + 'port': "6600", + }, 'sima': { + 'internal': "Crop, Lastfm, RandomFallBack", + 'contrib': "", 'user_db': "false", 'history_duration': "8", 'queue_length': "1", - 'consume': "0",}, + }, 'daemon':{ 'daemon': "false", - 'pidfile': "",}, + 'pidfile': "", + }, 'log': { - 'verbosity': "info"}, + 'verbosity': "info", + 'logfile': "", + }, + 'echonest': { + 'queue_mode': "track", #TODO control values + 'max_art': "15", + 'single_album': "false", + 'track_to_add': "1", + 'album_to_add': "1", + 'depth': "1", + }, 'lastfm': { - 'dynamic': "10", - 'similarity': "18", 'queue_mode': "track", #TODO control values + 'max_art': "10", 'single_album': "false", 'track_to_add': "1", 'album_to_add': "1", 'depth': "1", + }, + 'randomfallback': { + 'flavour': "sensible", # in pure, sensible, genre + 'track_to_add': "1", } } # @@ -100,6 +117,7 @@ class ConfMan(object): # CONFIG MANAGER CLASS self.init_config() self.control_conf() self.supersedes_config_with_cmd_line_options() + self.config['sima']['db_file'] = self.db_file def get_pw(self): try: @@ -109,11 +127,11 @@ class ConfMan(object): # CONFIG MANAGER CLASS return None except ValueError: # ValueError if password not a boolean, hence an actual password. - pw = self.config.get('MPD', 'password') - if not pw: + pwd = self.config.get('MPD', 'password') + if not pwd: self.log.debug('Password set as an empty string.') return None - return pw + return pwd def control_mod(self): """ @@ -229,7 +247,6 @@ class ConfMan(object): # CONFIG MANAGER CLASS self.db_file = join(data_dir, 'sima.db') config = configparser.SafeConfigParser() - # If no conf file present, uses defaults if not isfile(self.conf_file): self.config = config