aboutsummaryrefslogtreecommitdiff
path: root/app/dl_formats.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/dl_formats.py')
-rw-r--r--app/dl_formats.py12
1 files 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"})
bgstack15