X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Futils%2Fconfig.py;h=da66366042e082ee7e0b73f410bef2e9511d0ac7;hb=ce32823ab9d41112d989f4543432926eb38487e6;hp=c11d2e16bb82073dd972f920f5e90e08876b317b;hpb=e09e76d41b2f041de935e9e884009e3187005ab9;p=mpd-sima.git diff --git a/sima/utils/config.py b/sima/utils/config.py index c11d2e1..da66366 100644 --- a/sima/utils/config.py +++ b/sima/utils/config.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - -# Copyright (c) 2009, 2010, 2011, 2013 Jack Kaliko +# Copyright (c) 2009, 2010, 2011, 2013, 2014 Jack Kaliko # # This file is part of sima # @@ -36,35 +35,48 @@ 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': "", - 'port': "6600"}, + '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': "20", '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 + 'flavour': "sensible", # in pure, sensible 'track_to_add': "1", } } @@ -104,6 +116,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: @@ -113,11 +126,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): """ @@ -233,7 +246,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