import configparser class Config: """ A config reader class. """ def __init__(self, config_file): self._parser = configparser.ConfigParser() self._parser.read(config_file) # Mumble config def get_mumble_config(self, ): host = self._parser['MumbleServer']['host'] password = self._parser['MumbleServer']['password'] certfile = self._parser['MumbleServer']['certfile'] keyfile = self._parser['MumbleServer']['keyfile'] name = self._parser['MumbleServer']['name'] return (host, password, certfile, keyfile, name) # Ampache config def get_ampache_config(self): host = self._parser['AmpacheServer']['host'] version = self._parser['AmpacheServer']['api_version'] return (host, version) def get_auth(self): auth = self._parser['Auth']['key'] return auth def get_directories(self): download = self._parser['Misc']['download_folder'] delete_after_playing = bool(self._parser['Misc'] ['delete_after_playing']) return (download, delete_after_playing)