diff options
author | 1RandomDev <84292805+1RandomDev@users.noreply.github.com> | 2022-06-06 16:26:53 +0200 |
---|---|---|
committer | 1RandomDev <84292805+1RandomDev@users.noreply.github.com> | 2022-06-06 16:26:53 +0200 |
commit | de322ad5d138187aca24aff080c2db58f9845d25 (patch) | |
tree | 8298aa3ef2885e2e3b7685505bd4281815266da6 /app | |
parent | Merge pull request #144 from shalak/enhance_bookmarklets (diff) | |
download | metube-de322ad5d138187aca24aff080c2db58f9845d25.tar.gz metube-de322ad5d138187aca24aff080c2db58f9845d25.tar.bz2 metube-de322ad5d138187aca24aff080c2db58f9845d25.zip |
Added option for thumbnail only
Diffstat (limited to 'app')
-rw-r--r-- | app/dl_formats.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/dl_formats.py b/app/dl_formats.py index c06b93b..316d5df 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -19,6 +19,10 @@ def get_format(format: str, quality: str) -> str: if format.startswith("custom:"): return format[7:] + if format == "thumbnail": + # Quality is irrelevant in this case since we skip the download + return "bestaudio/best" + if format == "mp3": # Audio quality needs to be set post-download, set in opts return "bestaudio/best" @@ -66,4 +70,9 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict: opts["postprocessors"].append({"key": "FFmpegMetadata"}) opts["postprocessors"].append({"key": "EmbedThumbnail"}) + if format == "thumbnail": + opts["skip_download"] = True + opts["writethumbnail"] = True + opts["postprocessors"].append({"key": "FFmpegThumbnailsConvertor", "format": "jpg", "when": "before_dl"}) + return opts |