diff options
author | 1RandomDev <84292805+1RandomDev@users.noreply.github.com> | 2022-08-24 18:10:49 +0200 |
---|---|---|
committer | 1RandomDev <84292805+1RandomDev@users.noreply.github.com> | 2022-08-24 18:10:49 +0200 |
commit | 0f27bf854560fa37a5fa9f9d9645fe4c321fe487 (patch) | |
tree | 03a6c3a378038a72abf786546de8347273e92b31 | |
parent | Added option for thumbnail only (diff) | |
download | metube-0f27bf854560fa37a5fa9f9d9645fe4c321fe487.tar.gz metube-0f27bf854560fa37a5fa9f9d9645fe4c321fe487.tar.bz2 metube-0f27bf854560fa37a5fa9f9d9645fe4c321fe487.zip |
Set correct file extension for thumbnails
-rw-r--r-- | app/ytdl.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/ytdl.py b/app/ytdl.py index 38e29b8..8382184 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -6,6 +6,7 @@ import time import asyncio
import multiprocessing
import logging
+import re
from dl_formats import get_format, get_opts
log = logging.getLogger('ytdl')
@@ -124,6 +125,10 @@ class Download: self.tmpfilename = status.get('tmpfilename')
if 'filename' in status:
self.info.filename = os.path.relpath(status.get('filename'), self.download_dir)
+
+ # Set correct file extension for thumbnails
+ if(self.info.format == 'thumbnail'):
+ self.info.filename = re.sub(r'\.webm$', '.jpg', self.info.filename)
self.info.status = status['status']
self.info.msg = status.get('msg')
if 'downloaded_bytes' in status:
|