From d8e7261230bc7e1a8159b67b6caae92ac6a9fdca Mon Sep 17 00:00:00 2001 From: Tony Dalov Date: Sun, 15 Feb 2026 13:46:27 +0100 Subject: [PATCH] improve the current Presets UI by splitting the options into key:value pairs --- app/features/presets/schemas.py | 27 +++++++ ui/app/components/PresetForm.vue | 132 ++++++++++++++++++++++++++++++- 2 files changed, 156 insertions(+), 3 deletions(-) diff --git a/app/features/presets/schemas.py b/app/features/presets/schemas.py index 34ff8dc9..a95f3a82 100644 --- a/app/features/presets/schemas.py +++ b/app/features/presets/schemas.py @@ -57,6 +57,33 @@ class Preset(BaseModel): if not value: return "" + import shlex + + try: + tokens = shlex.split(value, posix=True) + processed_tokens = [] + prev_was_option = False + for token in tokens: + if token.startswith("-"): + processed_tokens.append(token) + prev_was_option = True + elif "=" in token: + key, val = token.split("=", 1) + if not key.startswith("-"): + key = "--" + key + processed_tokens.append(f"{key}={val}") + prev_was_option = False + elif prev_was_option: + processed_tokens.append(token) + prev_was_option = False + else: + processed_tokens.append("--" + token) + prev_was_option = False + + value = " ".join(processed_tokens) + except ValueError: + pass + try: from app.features.ytdlp.utils import arg_converter diff --git a/ui/app/components/PresetForm.vue b/ui/app/components/PresetForm.vue index 95fee478..89963136 100644 --- a/ui/app/components/PresetForm.vue +++ b/ui/app/components/PresetForm.vue @@ -164,8 +164,43 @@ Command options for yt-dlp - +
+ +
+ +
+
@@ -251,8 +286,8 @@