always set mp3 quality (closes #93)

This commit is contained in:
Alex 2021-12-21 08:50:19 +02:00 committed by GitHub
parent dadc18951a
commit e2ebb8c076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,13 +57,11 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict:
opts["postprocessors"] = []
if format == "mp3":
extra_args = {}
if quality != "best":
extra_args = {"preferredquality": quality}
opts["postprocessors"].append(
{"key": "FFmpegExtractAudio", "preferredcodec": "mp3", **extra_args},
)
opts["postprocessors"].append({
"key": "FFmpegExtractAudio",
"preferredcodec": "mp3",
"preferredquality": 0 if quality == "best" else quality},
})
opts["writethumbnail"] = True
opts["postprocessors"].append({"key": "FFmpegMetadata"})
opts["postprocessors"].append({"key": "EmbedThumbnail"})