44 строки
884 B
Python
44 строки
884 B
Python
from configparser import RawConfigParser
|
|
from enum import Enum
|
|
import os
|
|
|
|
|
|
config = RawConfigParser()
|
|
config.optionxform = str
|
|
config.read(
|
|
filenames='./config.ini',
|
|
)
|
|
|
|
|
|
class Section(Enum):
|
|
main = 'Main'
|
|
|
|
|
|
class Main:
|
|
host = config.get(
|
|
section=Section.main.value,
|
|
option='host',
|
|
fallback='127.0.0.1',
|
|
)
|
|
port = config.getint(
|
|
section=Section.main.value,
|
|
option='port',
|
|
fallback=8000,
|
|
)
|
|
working_directory = config.get(
|
|
section=Section.main.value,
|
|
option='working_directory',
|
|
fallback=os.getcwd(),
|
|
)
|
|
images_directory = config.get(
|
|
section=Section.main.value,
|
|
option='images_directory',
|
|
fallback=os.path.join(
|
|
os.getenv('APPDATA'),
|
|
'csasq',
|
|
'YT Music Live',
|
|
'cache',
|
|
'covers',
|
|
),
|
|
)
|