summaryrefslogtreecommitdiff
path: root/src/config.py
blob: 0c4916ddc71b28fdaa70b953b4967a4be46788fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)