• Operand
  • ya, coo. so?

gram: build

> ./config/nushell/media.nu

Lenses
(coming soon!)


source ./day.nu
source ./disc.nu

def channels [] { echo "needs encoding!" }

def "media place" [address: string] {
  d -b nvme0n1p7
  [ ~/disc/nvme0n1p7/media/youtube.com (basename $address) ] |
    path join | path expand }
  # let normal = "~/media" | path expand
  # if not (media base | path exists) { bind media media }

def --env "media base" [place?: path] {
  d -b nvme0n1p7; cd media/youtube.com; pwd }

def "media bundle" [...addresses: string] { $addresses | par-each { media address $in } }
def "media address" [address: string, place?: path] {
  let place = [ (media base) ($address | path basename) ] | path join
  print; print; print "----"
  print $"# [media address] Pulling ($address) -> ($place)"
  mkdir $place; cd $place

  (nsh yt-dlp yt-dlp
    --break-per-input # ... see `help yt-dlp`.
    --check-all-formats # ... see `help yt-dlp`.
    --check-formats # ... see `help yt-dlp`.
    --embed-thumbnail # ... see `help yt-dlp`.
    --no-resize-buffer # ... see `help yt-dlp`.
    --prefer-free-formats # ... see `help yt-dlp`.
    --live-from-start # ... see `help yt-dlp`.
# --yes-playlist # ... see `help yt-dlp`.

# log all enabled media encodings
# and capción languages.
# --list-formats
# --list-subs
# --sub-langs all # ... see `help yt-dlp`.
# --write-auto-subs # ... see `help yt-dlp`.

# slice open media packages,
# and pull an audio copy.
    --extract-audio
    --keep-video

    --lazy-playlist # ... see `help yt-dlp`.

# ensure copies are made using closed capcións
# include as many languages as possible.
# [chec] are dubbed audio copies included as an opción?
    --write-pages # ... see `help yt-dlp`.
    --write-subs # ... see `help yt-dlp`.

# log each, and record names and hashes in a cache.
    --download-archive arc.log

# signal dials - message packaging.
    --retries 24
# --http-chunk-size 8M
# --buffer-size 16384 # ... see `help yt-dlp`.
    --retry-sleep 12 # ... see `help yt-dlp`.
# --limit-rate 300M
# --throttled-rate 128M

    $address # a generic online media address;
    # many domains are already enrolled.

  ) | tee { print } | save -a $"(day).pull.log"
  mpv ...(glob ([ $place *.mkv ] | path join))
}

def "media channel" [...channels: string] {
  $channels | each {|channel| media address $"https://youtube.com/@($channel)" }
}