# -*- coding: utf-8 -*-
-# Copyright (c) 2009, 2010, 2011, 2013, 2014, 2015 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2009-2015, 2019-2020 kaliko <kaliko@azylum.org>
+# Copyright (c) 2019 sacha <sachahony@gmail.com>
#
# This file is part of sima
#
'musicbrainzid': "true",
'repeat_disable_queue': "true",
'single_disable_queue': "true",
+ 'mopidy_compat': "false",
},
- 'daemon':{
+ 'daemon': {
'daemon': False,
'pidfile': "",
},
'priority': 0,
},
'lastfm': {
- 'queue_mode': "track", #TODO control values
+ 'queue_mode': "track", # TODO control values
'max_art': 10,
'single_album': "false",
'track_to_add': 1,
'album_to_add': 1,
+ 'shuffle_album': False,
+ 'track_to_add_from_album': 0, # <=0 means keep all
'depth': 1,
'cache': True,
'priority': 100,
},
'random': {
- 'flavour': "sensible", # in pure, sensible
+ 'flavour': "sensible", # in pure, sensible
'track_to_add': 1,
'priority': 50,
},
+ 'tags': {
+ 'comment': "",
+ 'date': "",
+ 'genre': "",
+ 'label': "",
+ 'originaldate': "",
+ 'filter': "",
+ 'track_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.
# 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)
for opt in self.config.options(sec):
if opt in list(self.startopt.keys()):
self.config.set(sec, opt, str(self.startopt.get(opt)))
+ # honor MPD_HOST format as in mpc(1) for command line option --host
+ if self.startopt.get('host'):
+ if '@' in self.startopt.get('host'):
+ passwd, host = self.startopt.get('host').split('@')
+ self.config.set('MPD', 'password', passwd)
+ self.config.set('MPD', 'host', host)
def use_envar(self):
"""Use MPD en.var. to set defaults"""