From 3fe107b2991399a3ea0c446cf579e977b75817dd Mon Sep 17 00:00:00 2001 From: Alex Shnitman Date: Sun, 25 Jul 2021 20:56:56 +0300 Subject: set AUDIO_DOWNLOAD_DIR to the value if DOWNLOAD_DIR if it wasn't overriden in the environment --- app/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/main.py b/app/main.py index 194bba6..dad19e3 100644 --- a/app/main.py +++ b/app/main.py @@ -16,7 +16,7 @@ log = logging.getLogger('main') class Config: _DEFAULTS = { 'DOWNLOAD_DIR': '.', - 'AUDIO_DOWNLOAD_DIR': '.', + 'AUDIO_DOWNLOAD_DIR': '%%DOWNLOAD_DIR', 'URL_PREFIX': '', 'OUTPUT_TEMPLATE': '%(title)s.%(ext)s', } @@ -24,6 +24,9 @@ class Config: def __init__(self): for k, v in self._DEFAULTS.items(): setattr(self, k, os.environ[k] if k in os.environ else v) + for k, v in self.__dict__.items(): + if v.startswith('%%'): + setattr(self, k, getattr(self, v[2:])) if not self.URL_PREFIX.endswith('/'): self.URL_PREFIX += '/' -- cgit