minor changes to webui display
This commit is contained in:
parent
04e78f4c10
commit
d03e04db19
4 changed files with 40 additions and 5 deletions
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="column is-half-mobile">
|
||||
<div class="column is-half-mobile" v-if="hasDownloaded">
|
||||
<button type="button" class="button is-fullwidth is-link" :disabled="!hasSelected" @click="downloadSelected">
|
||||
<span class="icon-text is-block">
|
||||
<span class="icon"><i class="fa-solid fa-download" /></span>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
@click="deleteSelectedItems">
|
||||
<span class="icon-text is-block">
|
||||
<span class="icon"><i class="fa-solid fa-trash-can" /></span>
|
||||
<span>Remove</span>
|
||||
<span>{{ config.app.remove_files ? 'Remove' : 'Clear' }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -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.')
|
||||
|
|
|
|||
|
|
@ -127,6 +127,11 @@ div.is-centered {
|
|||
<li>
|
||||
When you export preset, it doesn't include <code>Cookies</code> field for security reasons.
|
||||
</li>
|
||||
<li>
|
||||
If you have created a global <code>config/ytdlp.cli</code> file, it will be appended to your exported preset
|
||||
<code><i class="fa-solid fa-terminal" /> Command arguments for yt-dlp</code> field for better compatibility
|
||||
and completeness.
|
||||
</li>
|
||||
</ul>
|
||||
</Message>
|
||||
</div>
|
||||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ const CONFIG_KEYS = {
|
|||
sentry_dsn: null,
|
||||
console_enabled: false,
|
||||
browser_enabled: false,
|
||||
ytdlp_cli: '',
|
||||
},
|
||||
presets: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue