aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorÖmer Erdinç Yağmurlu <omeryagmurlu@gmail.com>2021-07-25 00:31:58 +0200
committerÖmer Erdinç Yağmurlu <omeryagmurlu@gmail.com>2021-07-25 00:31:58 +0200
commitdabaae58e2f91b714ae94c5717b1d8d2592a78de (patch)
treed7cc62a8c53efa7ad16e9ee888fdff1eb68a7a15 /app
parentfirefox bookmarklet (diff)
downloadmetube-dabaae58e2f91b714ae94c5717b1d8d2592a78de.tar.gz
metube-dabaae58e2f91b714ae94c5717b1d8d2592a78de.tar.bz2
metube-dabaae58e2f91b714ae94c5717b1d8d2592a78de.zip
Add AUDIO_DOWNLOAD_DIR option
Diffstat (limited to 'app')
-rw-r--r--app/main.py1
-rw-r--r--app/ytdl.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/app/main.py b/app/main.py
index b8b512d..194bba6 100644
--- a/app/main.py
+++ b/app/main.py
@@ -16,6 +16,7 @@ log = logging.getLogger('main')
class Config:
_DEFAULTS = {
'DOWNLOAD_DIR': '.',
+ 'AUDIO_DOWNLOAD_DIR': '.',
'URL_PREFIX': '',
'OUTPUT_TEMPLATE': '%(title)s.%(ext)s',
}
diff --git a/app/ytdl.py b/app/ytdl.py
index c6b09ff..d29f108 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -148,7 +148,8 @@ class DownloadQueue:
elif etype == 'video' or etype.startswith('url') and 'id' in entry:
if entry['id'] not in self.queue:
dl = DownloadInfo(entry['id'], entry['title'], entry.get('webpage_url') or entry['url'])
- self.queue[entry['id']] = Download(self.config.DOWNLOAD_DIR, self.config.OUTPUT_TEMPLATE, quality, dl)
+ dldirectory = self.config.DOWNLOAD_DIR if quality != 'audio' else self.config.AUDIO_DOWNLOAD_DIR
+ self.queue[entry['id']] = Download(dldirectory, self.config.OUTPUT_TEMPLATE, quality, dl)
self.event.set()
await self.notifier.added(dl)
return {'status': 'ok'}
bgstack15