######################## LOGGING FACILITY #############################
#
[log]
-# message are logged to console
-#
+## LOGFILE
+# type: string (file path)
+# description: file to log to. Usually used in daemon mode.
+# default: logging to stdin/stdout
+logfile =
+##
+
## VERBOSITY
# type: string
+# description: log verbosity
+# Possible values:
+# * debug, *DEBUG LEVEL MIGHT PRINT OUT YOUR PASSWORD*
+# * info, default
+# * warning
+# * error
#
-# pick verbosity in : debug, info, warning, error
-# default if not specify is "info"
-# *DEBUG LEVEL MIGHT PRINT OUT YOUR PASSWORD*
verbosity = info
##
+
+
#
#######################################################################
sopt = StartOpt(info)
# set logger
verbosity = sopt.options.get('verbosity', 'warning')
+ logfile = sopt.options.get('logfile', None)
cli_loglevel = getattr(logging, verbosity.upper())
- set_logger(level=verbosity)
+ set_logger(level=verbosity, logfile=logfile)
logger = logging.getLogger('sima')
logger.setLevel(cli_loglevel)
# loads configuration
sima.shutdown()
-# Script starts here
-if __name__ == '__main__':
+def run():
+ """Catching broad exception
+ """
# pylint: disable=broad-except
try:
main()
except Exception:
exception_log()
+# Script starts here
+if __name__ == '__main__':
+ run()
# VIM MODLINE
# vim: ai ts=4 sw=4 sts=4 expandtab
def _cleanup_cache(self):
"""Avoid bloated cache
"""
- # TODO: call cleanup once its dict instance are used somewhere XXX
for _ , val in self._cache.items():
if isinstance(val, dict):
while len(val) > 150:
self.log.debug('Trying to find titles to add for "{}"'.format(
artist))
found = self.player.find_track(artist)
- # find tracks not in history
+ # find tracks not in history for artist
self.filter_track(found)
if len(self.to_add) == nbtracks_target:
break
'pidfile': "",},
'log': {
'verbosity': "info",
- 'logfile': "",},
+ 'logfile': "",
+ },
+ 'echonest': {
+ },
'lastfm': {
'dynamic': "10",
- 'similarity': "20",
+ 'similarity': "15",
'queue_mode': "track", #TODO control values
'single_album': "false",
'track_to_add': "1",
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):
"""