From cc09b607330385d6d81b9c47cf64a2442432e93f Mon Sep 17 00:00:00 2001 From: Soispha Date: Tue, 20 Feb 2024 16:35:15 +0100 Subject: refactor(treewide): Add a `.sh` extension to shell scripts --- hm/soispha/pkgs/scripts/wrappers/hibernate | 16 -------- hm/soispha/pkgs/scripts/wrappers/hibernate.sh | 16 ++++++++ hm/soispha/pkgs/scripts/wrappers/ll | 14 ------- hm/soispha/pkgs/scripts/wrappers/ll.sh | 14 +++++++ hm/soispha/pkgs/scripts/wrappers/lock | 19 --------- hm/soispha/pkgs/scripts/wrappers/lock.sh | 19 +++++++++ hm/soispha/pkgs/scripts/wrappers/lyrics | 11 ----- hm/soispha/pkgs/scripts/wrappers/lyrics.sh | 11 +++++ hm/soispha/pkgs/scripts/wrappers/mpc-fav | 15 ------- hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh | 15 +++++++ hm/soispha/pkgs/scripts/wrappers/mpc-rm | 14 ------- hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh | 14 +++++++ hm/soispha/pkgs/scripts/wrappers/show | 9 ----- hm/soispha/pkgs/scripts/wrappers/show.sh | 9 +++++ hm/soispha/pkgs/scripts/wrappers/sort_song | 33 --------------- hm/soispha/pkgs/scripts/wrappers/sort_song.sh | 33 +++++++++++++++ hm/soispha/pkgs/scripts/wrappers/spodi | 58 --------------------------- hm/soispha/pkgs/scripts/wrappers/spodi.sh | 58 +++++++++++++++++++++++++++ hm/soispha/pkgs/scripts/wrappers/virsh-del | 10 ----- hm/soispha/pkgs/scripts/wrappers/virsh-del.sh | 10 +++++ hm/soispha/pkgs/scripts/wrappers/yti | 34 ---------------- hm/soispha/pkgs/scripts/wrappers/yti.sh | 34 ++++++++++++++++ 22 files changed, 233 insertions(+), 233 deletions(-) delete mode 100755 hm/soispha/pkgs/scripts/wrappers/hibernate create mode 100755 hm/soispha/pkgs/scripts/wrappers/hibernate.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/ll create mode 100755 hm/soispha/pkgs/scripts/wrappers/ll.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/lock create mode 100755 hm/soispha/pkgs/scripts/wrappers/lock.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/lyrics create mode 100755 hm/soispha/pkgs/scripts/wrappers/lyrics.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/mpc-fav create mode 100755 hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/mpc-rm create mode 100755 hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/show create mode 100755 hm/soispha/pkgs/scripts/wrappers/show.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/sort_song create mode 100755 hm/soispha/pkgs/scripts/wrappers/sort_song.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/spodi create mode 100755 hm/soispha/pkgs/scripts/wrappers/spodi.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/virsh-del create mode 100755 hm/soispha/pkgs/scripts/wrappers/virsh-del.sh delete mode 100755 hm/soispha/pkgs/scripts/wrappers/yti create mode 100755 hm/soispha/pkgs/scripts/wrappers/yti.sh (limited to 'hm/soispha/pkgs/scripts/wrappers') diff --git a/hm/soispha/pkgs/scripts/wrappers/hibernate b/hm/soispha/pkgs/scripts/wrappers/hibernate deleted file mode 100755 index 96170bcb..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/hibernate +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -context="$(task _get rc.context)"; -[ "$context" ] && task context none - -# We have ensured that only one task is active -active="$(task +ACTIVE _ids)"; -[ "$active" ] && task stop "$active" - -systemctl hibernate "$@" - - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/hibernate.sh b/hm/soispha/pkgs/scripts/wrappers/hibernate.sh new file mode 100755 index 00000000..96170bcb --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/hibernate.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +context="$(task _get rc.context)"; +[ "$context" ] && task context none + +# We have ensured that only one task is active +active="$(task +ACTIVE _ids)"; +[ "$active" ] && task stop "$active" + +systemctl hibernate "$@" + + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/ll b/hm/soispha/pkgs/scripts/wrappers/ll deleted file mode 100755 index 2a65d0a6..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/ll +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -last_directory="$(mktemp)" - -command lf -last-dir-path="$last_directory" "$@" - -dir="$(cat "$last_directory")" -cd "$dir" || die "$dir does not exist!" -rm "$last_directory" - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/ll.sh b/hm/soispha/pkgs/scripts/wrappers/ll.sh new file mode 100755 index 00000000..2a65d0a6 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/ll.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +last_directory="$(mktemp)" + +command lf -last-dir-path="$last_directory" "$@" + +dir="$(cat "$last_directory")" +cd "$dir" || die "$dir does not exist!" +rm "$last_directory" + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/lock b/hm/soispha/pkgs/scripts/wrappers/lock deleted file mode 100755 index 376773c6..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/lock +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - - -context="$(task _get rc.context)"; -[ "$context" ] && task context none - -# We have ensured that only one task is active -active="$(task +ACTIVE _ids)"; -[ "$active" ] && task stop "$active" - -swaylock - -[ "$active" ] && task start "$active" - -[ "$context" ] && task context "$context" -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/lock.sh b/hm/soispha/pkgs/scripts/wrappers/lock.sh new file mode 100755 index 00000000..376773c6 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/lock.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + + +context="$(task _get rc.context)"; +[ "$context" ] && task context none + +# We have ensured that only one task is active +active="$(task +ACTIVE _ids)"; +[ "$active" ] && task stop "$active" + +swaylock + +[ "$active" ] && task start "$active" + +[ "$context" ] && task context "$context" +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/lyrics b/hm/soispha/pkgs/scripts/wrappers/lyrics deleted file mode 100755 index 83a01083..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/lyrics +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -( - cd "$XDG_MUSIC_DIR" || die "No music dir!" - exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less -) - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/lyrics.sh b/hm/soispha/pkgs/scripts/wrappers/lyrics.sh new file mode 100755 index 00000000..83a01083 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/lyrics.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +( + cd "$XDG_MUSIC_DIR" || die "No music dir!" + exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less +) + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/mpc-fav b/hm/soispha/pkgs/scripts/wrappers/mpc-fav deleted file mode 100755 index f9107ff6..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/mpc-fav +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -FAV_DIR="$XDG_MUSIC_DIR/playlists/favourites"; - -cd "$XDG_MUSIC_DIR" || die "No music dir!"; - -[ -d "$FAV_DIR" ] || mkdir --parents "$FAV_DIR"; - -ln -sr "$(mpc --format '%file%' current)" "$FAV_DIR/" || die "Link failed!"; - - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh b/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh new file mode 100755 index 00000000..f9107ff6 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/mpc-fav.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +FAV_DIR="$XDG_MUSIC_DIR/playlists/favourites"; + +cd "$XDG_MUSIC_DIR" || die "No music dir!"; + +[ -d "$FAV_DIR" ] || mkdir --parents "$FAV_DIR"; + +ln -sr "$(mpc --format '%file%' current)" "$FAV_DIR/" || die "Link failed!"; + + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/mpc-rm b/hm/soispha/pkgs/scripts/wrappers/mpc-rm deleted file mode 100755 index cc01c322..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/mpc-rm +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - - -cd "$XDG_MUSIC_DIR" || die "No music dir!" -trash-put "$(mpc --format '%file%' current)"; -mpc del 0; - - - - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh b/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh new file mode 100755 index 00000000..cc01c322 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/mpc-rm.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + + +cd "$XDG_MUSIC_DIR" || die "No music dir!" +trash-put "$(mpc --format '%file%' current)"; +mpc del 0; + + + + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/show b/hm/soispha/pkgs/scripts/wrappers/show deleted file mode 100755 index 95afb16c..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/show +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -# Maybe add `--quit-if-one-screen` -less --redraw-on-quit "$@" - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/show.sh b/hm/soispha/pkgs/scripts/wrappers/show.sh new file mode 100755 index 00000000..95afb16c --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/show.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +# Maybe add `--quit-if-one-screen` +less --redraw-on-quit "$@" + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/sort_song b/hm/soispha/pkgs/scripts/wrappers/sort_song deleted file mode 100755 index f539cf15..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/sort_song +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -case "$("$1" | tr '[:upper:]' '[:lower:]')" in - "lyrics") - filter="LYRICS"; - directory="lyrics"; - ;; - "instrumental") - filter="INSTRUMENTAL"; - directory="instrumental"; - ;; - *) - die "Expected 'instrumental|lyrics' but got '$1'"; -esac - -process() { - mediainfo --Output=JSON "$1" | jq '.media.track | map(.Lyrics) | join("")' -}; - -mkdir "../$directory"; - -fd . --extension=opus | while read -r file; do - if [ "$(process "$file")" = '""' ] || [ "$(process "$file")" = '"Instrumental"' ] || [ "$(process "$file")" = '"instrumental"' ]; then - echo "INSTRUMENTAL::$file"; - else - echo "LYRICS::$file"; - fi; - done | grep "$filter" | awk 'BEGIN {FS="::"}{print $2}' | while read -r file; do ln -s "../all/$file" "../$directory/$file"; done - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/sort_song.sh b/hm/soispha/pkgs/scripts/wrappers/sort_song.sh new file mode 100755 index 00000000..f539cf15 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/sort_song.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +case "$("$1" | tr '[:upper:]' '[:lower:]')" in + "lyrics") + filter="LYRICS"; + directory="lyrics"; + ;; + "instrumental") + filter="INSTRUMENTAL"; + directory="instrumental"; + ;; + *) + die "Expected 'instrumental|lyrics' but got '$1'"; +esac + +process() { + mediainfo --Output=JSON "$1" | jq '.media.track | map(.Lyrics) | join("")' +}; + +mkdir "../$directory"; + +fd . --extension=opus | while read -r file; do + if [ "$(process "$file")" = '""' ] || [ "$(process "$file")" = '"Instrumental"' ] || [ "$(process "$file")" = '"instrumental"' ]; then + echo "INSTRUMENTAL::$file"; + else + echo "LYRICS::$file"; + fi; + done | grep "$filter" | awk 'BEGIN {FS="::"}{print $2}' | while read -r file; do ln -s "../all/$file" "../$directory/$file"; done + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/spodi b/hm/soispha/pkgs/scripts/wrappers/spodi deleted file mode 100755 index f8bc5337..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/spodi +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -# This path must not contain spaces -DOWN_DIR="/home/soispha/media/music/down/spotify"; - -download_url="$1"; - - - -already_downloaded_files="$(mktmp)" -fd . "$DOWN_DIR" --exclude spotdl.log --exclude spotdl-errors.log > "$already_downloaded_files"; - -config="$(mktmp)" -cat << EOF | clean > "$config" -# Main options ---audio slider-kz bandcamp youtube-music piped youtube soundcloud ---lyrics genius musixmatch azlyrics synced - -# FFmpeg options ---ffmpeg ffmpeg ---threads 16 ---bitrate 256k - -# Spotify options ---cache-path /home/soispha/.cache/spotdl/.spotipy - -# Output options ---preload ---format opus ---output {artists}_-_{title} ---print-errors ---save-errors $DOWN_DIR/spotdl-errors.log -# TODO: Reactive whence spotdl support for these has improved <2023-12-19> -# --generate-lrc ---overwrite skip - -# Misc options ---log-level INFO -EOF - -if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then - die "something is already downloaded" -fi - -rm "$DOWN_DIR/spotdl.log" -cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" -touch "$DOWN_DIR/spotdl-errors.log" - - -# The sub shell needs to be unquoted, as the arguments may not be treated as one. -# shellcheck disable=2046 -unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log" - -[ -d ~/.spotdl ] && rm -r ~/.spotdl -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/spodi.sh b/hm/soispha/pkgs/scripts/wrappers/spodi.sh new file mode 100755 index 00000000..f8bc5337 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/spodi.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +# This path must not contain spaces +DOWN_DIR="/home/soispha/media/music/down/spotify"; + +download_url="$1"; + + + +already_downloaded_files="$(mktmp)" +fd . "$DOWN_DIR" --exclude spotdl.log --exclude spotdl-errors.log > "$already_downloaded_files"; + +config="$(mktmp)" +cat << EOF | clean > "$config" +# Main options +--audio slider-kz bandcamp youtube-music piped youtube soundcloud +--lyrics genius musixmatch azlyrics synced + +# FFmpeg options +--ffmpeg ffmpeg +--threads 16 +--bitrate 256k + +# Spotify options +--cache-path /home/soispha/.cache/spotdl/.spotipy + +# Output options +--preload +--format opus +--output {artists}_-_{title} +--print-errors +--save-errors $DOWN_DIR/spotdl-errors.log +# TODO: Reactive whence spotdl support for these has improved <2023-12-19> +# --generate-lrc +--overwrite skip + +# Misc options +--log-level INFO +EOF + +if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then + die "something is already downloaded" +fi + +rm "$DOWN_DIR/spotdl.log" +cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" +touch "$DOWN_DIR/spotdl-errors.log" + + +# The sub shell needs to be unquoted, as the arguments may not be treated as one. +# shellcheck disable=2046 +unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log" + +[ -d ~/.spotdl ] && rm -r ~/.spotdl +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/virsh-del b/hm/soispha/pkgs/scripts/wrappers/virsh-del deleted file mode 100755 index 96a9404d..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/virsh-del +++ /dev/null @@ -1,10 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -virsh destroy "$1" -virsh undefine "$1" --nvram -virsh vol-delete --pool default "$1".qcow2 - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/virsh-del.sh b/hm/soispha/pkgs/scripts/wrappers/virsh-del.sh new file mode 100755 index 00000000..96a9404d --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/virsh-del.sh @@ -0,0 +1,10 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +virsh destroy "$1" +virsh undefine "$1" --nvram +virsh vol-delete --pool default "$1".qcow2 + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/yti b/hm/soispha/pkgs/scripts/wrappers/yti deleted file mode 100755 index c07f6665..00000000 --- a/hm/soispha/pkgs/scripts/wrappers/yti +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH - -DOWN_DIR=/home/soispha/media/music/down/youtube - -tmp=$(mktmp) -config=$(mktmp) - -for e in "$DOWN_DIR"/*.opus;do echo "$e" >> "$tmp";done -[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" - -cat << EO > "$config" ---paths home:"$DOWN_DIR" -#--output %(fulltitle) ---restrict-filenames ---no-overwrites ---no-write-info-json ---clean-info-json ---prefer-free-formats -#--format mp3 ---extract-audio ---audio-quality 0 ---audio-format best -EO - - -rm "$DOWN_DIR/yt-dlp.log" -cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" - -unbuffer yt-dlp --config-location "$config" "$1" | tee "$DOWN_DIR/yt-dlp.log" - -# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/wrappers/yti.sh b/hm/soispha/pkgs/scripts/wrappers/yti.sh new file mode 100755 index 00000000..c07f6665 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/yti.sh @@ -0,0 +1,34 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.0.13" . %SHELL_LIBRARY_PATH + +DOWN_DIR=/home/soispha/media/music/down/youtube + +tmp=$(mktmp) +config=$(mktmp) + +for e in "$DOWN_DIR"/*.opus;do echo "$e" >> "$tmp";done +[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" + +cat << EO > "$config" +--paths home:"$DOWN_DIR" +#--output %(fulltitle) +--restrict-filenames +--no-overwrites +--no-write-info-json +--clean-info-json +--prefer-free-formats +#--format mp3 +--extract-audio +--audio-quality 0 +--audio-format best +EO + + +rm "$DOWN_DIR/yt-dlp.log" +cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" + +unbuffer yt-dlp --config-location "$config" "$1" | tee "$DOWN_DIR/yt-dlp.log" + +# vim: ft=sh -- cgit 1.4.1