feat(yt-dlp): add wrapper with embedding + SponsorBlock defaults
Add functions/yt-dlp.fish, shadowing yt-dlp to prepend sane defaults (--sponsorblock-remove all, --embed-subs, --embed-metadata, --embed-thumbnail). Each default is suppressed when the user already passes that flag, its alias (--add-metadata), its negation (--no-embed-thumbnail), the --opt=value form (--sponsorblock-remove=...), or the global --no-sponsorblock kill. User args pass through last so an explicit flag wins on precedence. Gated as a C1 opinionated alias; falls back to bare `command yt-dlp` when disabled. Register yt-dlp as a recommended (rec tier) dependency in the fish-deps catalog and document the function (§5.13) and dependency in the SSOT and index.
This commit is contained in:
@@ -16,27 +16,27 @@ function _fish_deps_catalog
|
||||
set -g _fdc_bins \
|
||||
uv cargo fish starship fzf zoxide direnv paru yay \
|
||||
wakatime tailscale \
|
||||
eza lsd bat btop dust duf prettyping ov rg lazygit lazydocker trash kitty wezterm python3
|
||||
eza lsd bat btop dust duf prettyping ov rg lazygit lazydocker trash kitty wezterm python3 yt-dlp
|
||||
|
||||
set -g _fdc_tiers \
|
||||
rec rec req rec req req rec rec rec \
|
||||
int int \
|
||||
rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec
|
||||
rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec
|
||||
|
||||
set -g _fdc_cargo \
|
||||
"" "" "" starship "" zoxide "" "" "" \
|
||||
"" "" \
|
||||
eza lsd bat "" du-dust "" "" ov ripgrep "" "" trashy "" "" ""
|
||||
eza lsd bat "" du-dust "" "" ov ripgrep "" "" trashy "" "" "" ""
|
||||
|
||||
set -g _fdc_pm \
|
||||
uv cargo fish starship fzf zoxide direnv "" yay \
|
||||
wakatime tailscale \
|
||||
eza lsd bat btop dust duf prettyping ov ripgrep lazygit lazydocker trash kitty wezterm python
|
||||
eza lsd bat btop dust duf prettyping ov ripgrep lazygit lazydocker trash kitty wezterm python yt-dlp
|
||||
|
||||
set -g _fdc_special \
|
||||
curl-uv rustup-installer git-cargo-fish curl-installer fzf-update "" "" paru-build yay-build \
|
||||
wakatime-binary "" \
|
||||
"" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" "" ""
|
||||
"" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" "" "" ""
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# SYNOPSIS
|
||||
# yt-dlp [args...] URL [URL...]
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Wraps yt-dlp, injecting sane embedding + SponsorBlock defaults
|
||||
# (--sponsorblock-remove all, --embed-subs, --embed-metadata,
|
||||
# --embed-thumbnail). Each default is suppressed if the user already
|
||||
# passes that flag, its alias, or its negation (e.g. --no-embed-thumbnail
|
||||
# drops our --embed-thumbnail). All other arguments pass through
|
||||
# untouched. --help and friends fall through to real yt-dlp.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to yt-dlp (defaults prepended)
|
||||
#
|
||||
# EXAMPLE
|
||||
# yt-dlp dQw4w9WgXcQ
|
||||
# yt-dlp --no-embed-thumbnail dQw4w9WgXcQ # drops our thumbnail default
|
||||
function yt-dlp --description 'yt-dlp with embedding + SponsorBlock defaults'
|
||||
# Opinionated guard (C1): fall back to bare command yt-dlp when disabled.
|
||||
if not __fish_config_op_enabled __fish_config_op_aliases
|
||||
command yt-dlp $argv
|
||||
return $status
|
||||
end
|
||||
|
||||
set -l extra
|
||||
|
||||
# --embed-subs (skip if set or negated)
|
||||
if not contains -- --embed-subs $argv
|
||||
and not contains -- --no-embed-subs $argv
|
||||
set -a extra --embed-subs
|
||||
end
|
||||
|
||||
# --embed-thumbnail (skip if set or negated)
|
||||
if not contains -- --embed-thumbnail $argv
|
||||
and not contains -- --no-embed-thumbnail $argv
|
||||
set -a extra --embed-thumbnail
|
||||
end
|
||||
|
||||
# --embed-metadata (aliases: --add-metadata / --no-add-metadata)
|
||||
if not contains -- --embed-metadata $argv
|
||||
and not contains -- --add-metadata $argv
|
||||
and not contains -- --no-embed-metadata $argv
|
||||
and not contains -- --no-add-metadata $argv
|
||||
set -a extra --embed-metadata
|
||||
end
|
||||
|
||||
# --sponsorblock-remove all
|
||||
# Skip if the user set their own remove (bare or --opt=value form), or
|
||||
# disabled SponsorBlock entirely with --no-sponsorblock.
|
||||
if not string match -q -- '--sponsorblock-remove' $argv
|
||||
and not string match -q -- '--sponsorblock-remove=*' $argv
|
||||
and not contains -- --no-sponsorblock $argv
|
||||
set -a extra --sponsorblock-remove all
|
||||
end
|
||||
|
||||
# User args last so an explicit flag wins any store_true/false precedence.
|
||||
command yt-dlp $extra $argv
|
||||
end
|
||||
Reference in New Issue
Block a user