'help_no': _("Don't show warning when focus is lost"),
'type': 'boolean'
},
+ 'load_all_musics': {
+ 'default': True,
+ 'help_yes': _("Load all the musics at launch time (default)"),
+ 'help_no': _("Don't load all the musics at launch time (use it if you \
+ have memory problems)"),
+ 'type': 'boolean'
+ },
'list_devices': {
'help': _("List available sound devices"),
'type': 'action'
'language',
'list_devices',
'device',
+ 'load_all_musics',
]
def parse_args():
argv = sys.argv[1 :]
if not Config.music_path.endswith("/"):
Config.music_path = Config.music_path + "/"
+def dump_config():
+ max_size = max(max(map(len, Configs_order)), len('config'))
+ info_print("{:<{}} : {}".format(
+ "config", max_size, Config.yml_file))
+ for item in Config.__dict__:
+ if item in Configs_order:
+ info_print("{:<{}} : {}".format(
+ item, max_size, getattr(Config, item)))
+
def build_config(args):
- stream = open(Config.yml_file, "r")
+ stream = open(Config.yml_file, "r", encoding='utf8')
try:
config = yaml.safe_load(stream)
except Exception as e:
Logger.warn('MusicSampler: ' + message, exc_info=with_trace)
+def info_print(message, with_trace=None):
+ if with_trace is None:
+ with_trace = (Logger.getEffectiveLevel() < logging.WARN)
+ with_trace &= (sys.exc_info()[0] is not None)
+
+ Logger.info('MusicSampler: ' + message, exc_info=with_trace)
+