def config_test(self): """Verify this plugin's configuration.""" errors = [] if "stream_url" not in self.config: errors.append('[plugin:SomaFM] does not have the required key "stream_url"') if "source_name" not in self.config: errors.append('[plugin:SomaFM] does not have the required key "stream_url"') if "extra_delay" not in self.config: errors.append( '[plugin:SomaFM] does not have the required key "extra_delay"' ) elif type(self.config["extra_delay"]) is not float: errors.append( "[plugin:SomaFM] does not have a float value for" ' the key "extra_delay"' ) if "start_disabled" not in self.config: errors.append( '[plugin:SomaFM] does not have the required key "start_disabled"' ) elif type(self.config["start_disabled"]) is not bool: errors.append( "[plugin:SomaFM] does not have a boolean" 'value for the key "start_disabled"' ) if "marker_prefix" not in self.config: errors.append( '[plugin:SomaFM] does not have the required key "marker_prefix"' ) if len(errors) > 0: raise conf.InvalidConfigurationError(errors)
def config_test(self): """Verify this plugin's configuration.""" errors = [] if "stream_url" not in self.config: errors.append("[plugin:somafm] does not have the required key" ' "stream_url"') if "source_name" not in self.config: errors.append("[plugin:somafm] does not have the required key" ' "stream_url"') if "extra_delay" not in self.config: errors.append("[plugin:somafm] does not have the required key" ' "extra_delay"') elif not conf.is_float(self.config["extra_delay"]): errors.append("[plugin:somafm] does not have a float value for" ' the key "extra_delay"') if "start_disabled" not in self.config: errors.append("[plugin:somafm] does not have the required key " '"start_disabled"') elif not conf.is_bool(self.config["start_disabled"]): errors.append("[plugin:somafm] does not have a boolean-parseable" 'value for the key "start_disabled"') if "marker_prefix" not in self.config: errors.append("[plugin:one_eighty_one_fm] does not have the " 'required key "marker_prefix"') if len(errors) > 0: raise conf.InvalidConfigurationError(errors)
def config_test(self): """Test the configuration to ensure that it contains the required items. Also, convert any configuration items to the right formats, and perform variable expansions. """ errors = [] if "poll_url" not in self.config: errors.append("[plugin:icecast] does not have the required key" ' "poll_url"') if "prefix_file" not in self.config: errors.append("[plugin:icecast] does not have the required key" ' "prefix_file"') # Throw exception if necessary. if len(errors) > 0: raise conf.InvalidConfigurationError(errors)
def validate_config(self): """Ensure the configuration is valid, and perform path expansion.""" errors = [] if "path" not in self.config.keys(): errors.append("[plugin:now_playing_file] is missing the required" ' key "path"') else: self.config["path"] = os.path.expandvars(self.config["path"]) if "delayed" not in self.config.keys(): self.config["delayed"] = "False" else: if not conf.is_bool(self.config["delayed"]): errors.append("[plugin:now_playing_file] has a non-boolean " 'value for the key "delayed"') # Return errors, if any if len(errors) > 0: raise conf.InvalidConfigurationError(errors)
def validate_config(self): """Ensure the configuration is valid, and perform path expansion.""" errors = [] if "path" not in self.config.keys(): errors.append( '["plugin:NowPlayingFile"] is missing the required key "path"') else: self.config["path"] = os.path.expandvars(self.config["path"]) if "delayed" not in self.config.keys(): self.config["delayed"] = "False" else: if type(self.config["delayed"]) is not bool: errors.append('["plugin:NowPlayingFile"] has a non-boolean ' 'value for the key "delayed"') # Return errors, if any if len(errors) > 0: raise conf.InvalidConfigurationError(errors)