aboutsummaryrefslogtreecommitdiff
path: root/app/ytdl.py
diff options
context:
space:
mode:
authorAlfred Toth <alfred.toth@inctoo.de>2021-05-18 16:15:49 +0200
committerAlfred Toth <alfred.toth@inctoo.de>2021-05-18 16:15:49 +0200
commitc8462012a1ef4e7d7ec97f31364cb466dd895ba5 (patch)
treead3238176c80e039dc9a24c1413c9e2762f24377 /app/ytdl.py
parentupgraded youtube-dl (diff)
downloadmetube-c8462012a1ef4e7d7ec97f31364cb466dd895ba5.tar.gz
metube-c8462012a1ef4e7d7ec97f31364cb466dd895ba5.tar.bz2
metube-c8462012a1ef4e7d7ec97f31364cb466dd895ba5.zip
environment variable to customize output file names
Diffstat (limited to 'app/ytdl.py')
-rw-r--r--app/ytdl.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/ytdl.py b/app/ytdl.py
index dfdc4fd..c6b09ff 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -32,8 +32,9 @@ class DownloadInfo:
class Download:
manager = None
- def __init__(self, download_dir, quality, info):
+ def __init__(self, download_dir, output_template, quality, info):
self.download_dir = download_dir
+ self.output_template = output_template
if quality == 'best':
self.format = None
elif quality in ('1440p', '1080p', '720p', '480p'):
@@ -59,7 +60,7 @@ class Download:
'quiet': True,
'no_color': True,
#'skip_download': True,
- 'outtmpl': os.path.join(self.download_dir, '%(title)s.%(ext)s'),
+ 'outtmpl': os.path.join(self.download_dir, self.output_template),
'format': self.format,
'cachedir': False,
'socket_timeout': 30,
@@ -147,7 +148,7 @@ 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, quality, dl)
+ self.queue[entry['id']] = Download(self.config.DOWNLOAD_DIR, self.config.OUTPUT_TEMPLATE, quality, dl)
self.event.set()
await self.notifier.added(dl)
return {'status': 'ok'}
bgstack15