yandex-music-download/config/main.py

69 строки
1.3 KiB
Python

from configparser import RawConfigParser
import os
cwd = os.getcwd()
config = RawConfigParser()
config.optionxform = str
config.read(
os.path.join(
cwd,
'config.ini',
),
encoding='utf-8',
)
class Main:
working_directory = config.get(
section='Main',
option='working_directory',
fallback=cwd,
)
class Download:
dirname = config.get(
section='Download',
option='dirname',
fallback='music',
)
filename = config.get(
section='Download',
option='filename',
fallback='%(artists)s%(title)s.%(codec)s',
)
escape_symbols = config.get(
section='Download',
option='escape_symbols',
fallback=r'\/:*?"<>|',
)
codec = config.get(
section='Download',
option='codec',
fallback='mp3',
)
bitrate = config.getint(
section='Download',
option='bitrate',
fallback=320,
)
min_delay = config.getint(
section='Download',
option='min_delay',
fallback=0,
)
max_delay = config.getint(
section='Download',
option='max_delay',
fallback=0,
)
class Yandex:
token = config.get(
section='Yandex',
option='token',
)