aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Shnitman <alexta69@gmail.com>2021-07-25 20:56:56 +0300
committerAlex Shnitman <alexta69@gmail.com>2021-07-25 21:22:20 +0300
commit3fe107b2991399a3ea0c446cf579e977b75817dd (patch)
tree86904ea2cedc183386c6a24be689c45912fb39aa /app
parentAdd AUDIO_DOWNLOAD_DIR option (diff)
downloadmetube-3fe107b2991399a3ea0c446cf579e977b75817dd.tar.gz
metube-3fe107b2991399a3ea0c446cf579e977b75817dd.tar.bz2
metube-3fe107b2991399a3ea0c446cf579e977b75817dd.zip
set AUDIO_DOWNLOAD_DIR to the value if DOWNLOAD_DIR if it wasn't overriden in the environment
Diffstat (limited to 'app')
-rw-r--r--app/main.py5
1 files changed, 4 insertions, 1 deletions
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 += '/'
bgstack15