]> kaliko git repositories - mpd-sima.git/blobdiff - sima/utils/config.py
Refactored lastfm/echonest webservices
[mpd-sima.git] / sima / utils / config.py
index c11d2e16bb82073dd972f920f5e90e08876b317b..99fb3227b7b69b18f085d513dcefcb99e608c67d 100644 (file)
@@ -36,28 +36,41 @@ 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",
@@ -104,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:
@@ -113,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):
         """
@@ -233,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