]> kaliko git repositories - mpd-sima.git/blobdiff - sima/utils/config.py
Default config definition more consistent
[mpd-sima.git] / sima / utils / config.py
index c7dbab6c4c5e5bc85043b0d6063bb616e5f374db..616a01f5bf16d26cac971d97b352cf5dd2138698 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (c) 2009-2015, 2019 kaliko <kaliko@azylum.org>
+# Copyright (c) 2009-2015, 2019-2021 kaliko <kaliko@azylum.org>
 # Copyright (c) 2019 sacha <sachahony@gmail.com>
 #
 #  This file is part of sima
@@ -49,14 +49,14 @@ DEFAULT_CONF = {
         'sima': {
             'internal': "Crop, Lastfm, Random",
             'contrib': "",
-            'user_db': "false",
+            'user_db': False,
             'history_duration': 8,
             'queue_length': 2,
             'var_dir': 'empty',
-            'musicbrainzid': "true",
-            'repeat_disable_queue': "true",
-            'single_disable_queue': "true",
-            'mopidy_compat': "false",
+            'musicbrainzid': True,
+            'repeat_disable_queue': True,
+            'single_disable_queue': True,
+            'mopidy_compat': False,
             },
         'daemon': {
             'daemon': False,
@@ -73,7 +73,7 @@ DEFAULT_CONF = {
         'lastfm': {
             'queue_mode': "track",  # TODO control values
             'max_art': 10,
-            'single_album': "false",
+            'single_album': False,
             'track_to_add': 1,
             'album_to_add': 1,
             'shuffle_album': False,
@@ -87,11 +87,31 @@ DEFAULT_CONF = {
             'track_to_add': 1,
             'priority': 50,
             },
+        'tags': {
+            'comment': "",
+            'date': "",
+            'genre': "",
+            'label': "",
+            'originaldate': "",
+            'filter': "",
+            'queue_mode': "track",
+            'single_album': False,
+            'track_to_add': 1,
+            'album_to_add': 1,
+            'priority': 80,
+            },
+        'genre': {
+            'queue_mode': "track",
+            'single_album': False,
+            'track_to_add': 1,
+            'album_to_add': 1,
+            'priority': 80,
+            },
         }
 #
 
 
-class ConfMan(object):  # CONFIG MANAGER CLASS
+class ConfMan:  # CONFIG MANAGER CLASS
     """
     Configuration manager.
     Default configuration is stored in DEFAULT_CONF dictionnary.
@@ -130,7 +150,7 @@ class ConfMan(object):  # CONFIG MANAGER CLASS
         # Create directories
         data_dir = self.config['sima']['var_dir']
         if not isdir(data_dir):
-            self.log.trace('Creating "{}"'.format(data_dir))
+            self.log.trace('Creating "%s"', data_dir)
             makedirs(data_dir)
             chmod(data_dir, 0o700)
 
@@ -185,7 +205,6 @@ class ConfMan(object):  # CONFIG MANAGER CLASS
         # honor MPD_HOST format as in mpc(1)  for command line option --host
         if self.startopt.get('host'):
             if '@' in self.startopt.get('host'):
-                print(self.startopt.get('host').split('@'))
                 passwd, host = self.startopt.get('host').split('@')
                 self.config.set('MPD', 'password', passwd)
                 self.config.set('MPD', 'host', host)