From e2ebb8c07606f7a9dea8735e0fc20085f0c558e8 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 21 Dec 2021 08:50:19 +0200 Subject: always set mp3 quality (closes #93) --- app/dl_formats.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/dl_formats.py b/app/dl_formats.py index 121ce6b..2a5bb5a 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -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"}) -- cgit