mirror of
https://github.com/alexta69/metube.git
synced 2025-04-04 12:47:38 +03:00
thumbs
This commit is contained in:
parent
0aa5571730
commit
e635a4a7f5
1 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
|||
import copy
|
||||
|
||||
def get_format(format: str, quality: str) -> str:
|
||||
"""
|
||||
Returns format for download
|
||||
|
@ -48,15 +50,22 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict:
|
|||
Returns:
|
||||
ytdl_opts: Extra options
|
||||
"""
|
||||
if "postprocessors" not in ytdl_opts:
|
||||
ytdl_opts["postprocessors"] = []
|
||||
|
||||
opts = copy.deepcopy(ytdl_opts)
|
||||
|
||||
if "postprocessors" not in opts:
|
||||
opts["postprocessors"] = []
|
||||
|
||||
if format == "mp3":
|
||||
extra_args = {}
|
||||
if quality != "best":
|
||||
extra_args = {"preferredquality": quality}
|
||||
ytdl_opts["postprocessors"].append(
|
||||
|
||||
opts["postprocessors"].append(
|
||||
{"key": "FFmpegExtractAudio", "preferredcodec": "mp3", **extra_args},
|
||||
)
|
||||
|
||||
return ytdl_opts
|
||||
opts["writethumbnail"] = True
|
||||
opts["postprocessors"].append({"key": "FFmpegMetadata"})
|
||||
opts["postprocessors"].append({"key": "EmbedThumbnail"})
|
||||
|
||||
return opts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue