From 4c00e639aef1ba6e5ad8820fdcd548708acf3d14 Mon Sep 17 00:00:00 2001 From: Anthony van Winkle Date: Wed, 29 May 2024 14:56:46 -0700 Subject: [PATCH] Re-enable sound pools if MC is installed --- mpf/config_spec.yaml | 6 +++++- mpf/core/config_processor.py | 10 +++++++--- mpf/core/config_validator.py | 5 ++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mpf/config_spec.yaml b/mpf/config_spec.yaml index d2e034c29..f44b1c0c5 100644 --- a/mpf/config_spec.yaml +++ b/mpf/config_spec.yaml @@ -1700,8 +1700,12 @@ sound_player: events_when_looping: list|event_posted|None events_when_about_to_finish: list|event_posted|None key: single|str|None +sound_pools: + __valid_in__: machine, mode # todo add to validator + __type__: config_dict + __allow_others__: sound_ducking: - bus: single|str|None + bus: single|str| attack: single|secs| attenuation: single|float| delay: single|secs|0.0 diff --git a/mpf/core/config_processor.py b/mpf/core/config_processor.py index dc14326cc..cd270a3bd 100755 --- a/mpf/core/config_processor.py +++ b/mpf/core/config_processor.py @@ -150,19 +150,23 @@ def _check_sections(self, config_spec, config, config_type, filename, ignore_unk if not isinstance(config, dict): raise ConfigFileError("Config should be a dict: {}".format(config), 1, self.log.name, filename) - deprecated_080 = ["playlists", "playlist_player", "slides", "sounds", "sound_pools", "sound_loop_player", + deprecated_080 = ["sound_pools"] + invalid_080 = ["playlists", "playlist_player", "slides", "sounds", "sound_loop_player", "sound_loop_sets", "sound_system", "track_player", "widgets"] for k in config.keys(): if k in config_spec: + if k in deprecated_080: + self.log.warning("Config section '%s' is deprecated in MPF 0.80 and will be unsupported in future versions. " + "Please migrate this config to GMC.", k) if config_type not in config_spec[k]['__valid_in__']: raise ConfigFileError('Found a "{}:" section in config file {}, ' 'but that section is not valid in {} config ' 'files (only in {}).'.format(k, filename, config_type, config_spec[k]['__valid_in__']), 2, self.log.name, filename) - elif k in deprecated_080: + elif k in invalid_080: # MPF 0.80 DEPRECATION - self.log.warning("Config section '%s' is deprecated in MPF 0.80 and will be ignored.", k) + self.log.error("Config section '%s' is removed in MPF 0.80 and will be ignored.", k) elif not ignore_unknown_sections: suggestion = self._find_similar_key(k, config_spec, config_type) diff --git a/mpf/core/config_validator.py b/mpf/core/config_validator.py index 79b407a97..a0dc6837a 100644 --- a/mpf/core/config_validator.py +++ b/mpf/core/config_validator.py @@ -353,7 +353,10 @@ def check_for_invalid_sections(self, spec, config, validation_failure_info): validation_failure_info.parent.item, config), 3, self.log.name) def _validate_type_subconfig(self, item, param, validation_failure_info): - if item is None: + # The inclusion of sound_pools causes a nested ducking subconfig that + # fails due to missing required properties. Check for an empty dict + # as subconfig and ignore it. + if item is None or not len(item): return {} try: attribute, base_spec_str = param.split(",", 1)