diff options
Diffstat (limited to 'home-manager/packages/scripts/wrappers/spodi')
-rwxr-xr-x | home-manager/packages/scripts/wrappers/spodi | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/home-manager/packages/scripts/wrappers/spodi b/home-manager/packages/scripts/wrappers/spodi new file mode 100755 index 00000000..9c440340 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/spodi @@ -0,0 +1,39 @@ +#!/bin/sh + +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +DOWN_DIR=/home/dt/media/playlist/down/ + + +tmp=$(mktemp) +config=$(mktemp) + +for e in "$DOWN_DIR"/*.mp3;do echo "$e" >> "$tmp";done +cat << EO > "$config" +--log-level INFO +--cache-path /home/dt/.config/spotdl/.spotipy +--audio youtube-music youtube +--lyrics genius musixmatch azlyrics +--ffmpeg ffmpeg +--format mp3 +--output {artists}-{title}.{output-ext} +--overwrite skip +--client-id 5f573c9620494bae87890c0f08a60293 +--client-secret 212476d9b0f3472eaa762d90b19b0ba8 +--threads 16 +--print-errors +--preload +EO + +[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" + +rm ${DOWN_DIR}spotdl.log +cd $DOWN_DIR || die "BUG: no $DOWN_DIR" + +unbuffer spotdl $(cat "$config") download "$1" | tee $DOWN_DIR/spotdl.log + +[ -d ~/.spotdl ] && rm -r ~/.spotdl +rm "$tmp" +rm "$config" |