From d03e04db19d86001999d313d84acc205892baac2 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Fri, 4 Apr 2025 02:07:56 +0300 Subject: [PATCH] minor changes to webui display --- app/library/config.py | 11 ++++++++--- ui/components/History.vue | 19 +++++++++++++++++-- ui/pages/presets.vue | 14 ++++++++++++++ ui/stores/ConfigStore.js | 1 + 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/app/library/config.py b/app/library/config.py index 800a4907..761ec81e 100644 --- a/app/library/config.py +++ b/app/library/config.py @@ -148,6 +148,9 @@ class Config: ytdlp_auto_update: bool = False """Enable in-place auto update of yt-dlp package.""" + ytdlp_cli: str = "" + """The command line options to use for yt-dlp.""" + pictures_backends: list[str] = [ "https://unsplash.it/1920/1080?random", "https://picsum.photos/1920/1080", @@ -171,6 +174,7 @@ class Config: "tasks", "new_version_available", "started", + "ytdlp_cli", ) "The variables that are immutable." @@ -217,6 +221,7 @@ class Config: "sentry_dsn", "console_enabled", "browser_enabled", + "ytdlp_cli", ) "The variables that are relevant to the frontend." @@ -323,12 +328,12 @@ class Config: if os.path.exists(opts_file) and os.path.getsize(opts_file) > 2: LOG.info(f"Loading yt-dlp custom options from '{opts_file}'.") with open(opts_file) as f: - ytdlp_cli_opts = f.read().strip() - if ytdlp_cli_opts: + self.ytdlp_cli = f.read().strip() + if self.ytdlp_cli: try: removed_options = [] self.ytdl_options = arg_converter( - args=ytdlp_cli_opts, + args=self.ytdlp_cli, level=1, removed_options=removed_options, ) diff --git a/ui/components/History.vue b/ui/components/History.vue index d852e64b..f6fca351 100644 --- a/ui/components/History.vue +++ b/ui/components/History.vue @@ -22,7 +22,7 @@ -
+
@@ -455,6 +455,21 @@ const hasCompleted = computed(() => { return false }) +const hasDownloaded = computed(() => { + if (Object.keys(stateStore.history)?.length < 0) { + return false + } + + for (const key in stateStore.history) { + const element = stateStore.history[key] + if (element.status === 'finished' && element.filename) { + console.log(element); + return true + } + } + return false +}) + const deleteSelectedItems = () => { if (selectedElms.value.length < 1) { toast.error('No items selected.') diff --git a/ui/pages/presets.vue b/ui/pages/presets.vue index c0197658..a9bebb5e 100644 --- a/ui/pages/presets.vue +++ b/ui/pages/presets.vue @@ -127,6 +127,11 @@ div.is-centered {
  • When you export preset, it doesn't include Cookies field for security reasons.
  • +
  • + If you have created a global config/ytdlp.cli file, it will be appended to your exported preset + Command arguments for yt-dlp field for better compatibility + and completeness. +
  • @@ -307,6 +312,15 @@ const exportItem = item => { userData[key] = data[key] } + if (config?.app?.ytdlp_cli) { + const val = `# exported from ytdlp.cli #\n${config.app.ytdlp_cli}\n# exported from ytdlp.cli #\n` + if (userData.cli) { + userData.cli = val + "\n" + userData.cli + } else { + userData.cli = val + } + } + userData['_type'] = 'preset' userData['_version'] = '2.0' diff --git a/ui/stores/ConfigStore.js b/ui/stores/ConfigStore.js index 35aa31be..033b0902 100644 --- a/ui/stores/ConfigStore.js +++ b/ui/stores/ConfigStore.js @@ -18,6 +18,7 @@ const CONFIG_KEYS = { sentry_dsn: null, console_enabled: false, browser_enabled: false, + ytdlp_cli: '', }, presets: [ {