diff options
Diffstat (limited to '')
-rwxr-xr-x | home-manager/packages/scripts/wrappers/spodi | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/home-manager/packages/scripts/wrappers/spodi b/home-manager/packages/scripts/wrappers/spodi index 41d2b443..87a6196c 100755 --- a/home-manager/packages/scripts/wrappers/spodi +++ b/home-manager/packages/scripts/wrappers/spodi @@ -3,23 +3,24 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH +DOWN_DIR="/home/soispha/media/music/down"; -DOWN_DIR=/home/soispha/media/music/down/ +download_url="$1"; -tmp=$(mktmp) -config=$(mktmp) -fd . "$DOWN_DIR" --exclude spotdl.log > "$tmp"; +already_downloaded_files="$(mktmp)" +fd . "$DOWN_DIR" --exclude spotdl.log > "$already_downloaded_files"; +config="$(mktmp)" cat << EO > "$config" --log-level INFO ---cache-path /home/soispha/.config/spotdl/.spotipy +--cache-path /home/soispha/.local/share/spotdl/.spotipy --audio youtube-music youtube --lyrics genius musixmatch azlyrics --ffmpeg ffmpeg --format mp3 ---output {artists}-{title}.{output-ext} +--output {artists}_-_{title} --overwrite skip --client-id 5f573c9620494bae87890c0f08a60293 --client-secret 212476d9b0f3472eaa762d90b19b0ba8 @@ -28,12 +29,17 @@ cat << EO > "$config" --preload EO -[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" +if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then + die "something is already downloaded" +fi -rm "${DOWN_DIR}spotdl.log" +rm "$DOWN_DIR/spotdl.log" cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" + # The sub shell needs to be unquoted, as the arguments may not be treated as one. -unbuffer spotdl $(cat "$config") download "$1" | tee "$DOWN_DIR/spotdl.log" +# shellcheck disable=2046 +unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log" [ -d ~/.spotdl ] && rm -r ~/.spotdl +# vim: ft=sh |