Added option for thumbnail only

This commit is contained in:
1RandomDev 2022-06-06 16:26:53 +02:00
parent 9557b9d65a
commit de322ad5d1
2 changed files with 16 additions and 0 deletions

View file

@ -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