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 @@