diff options
Diffstat (limited to 'home-manager')
-rw-r--r-- | home-manager/packages/scripts.nix | 2 | ||||
-rwxr-xr-x | home-manager/packages/scripts/wrappers/spodi | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/home-manager/packages/scripts.nix b/home-manager/packages/scripts.nix index a647076c..f5a06348 100644 --- a/home-manager/packages/scripts.nix +++ b/home-manager/packages/scripts.nix @@ -68,7 +68,7 @@ spodi-scr = write_script { name = "spodi"; path = "wrappers"; - dependencies = builtins.attrValues {inherit (pkgs) gawk expect spotdl;}; + dependencies = builtins.attrValues {inherit (pkgs) gawk expect spotdl fd coreutils ;}; }; virsh-del-scr = write_script { name = "virsh-del"; diff --git a/home-manager/packages/scripts/wrappers/spodi b/home-manager/packages/scripts/wrappers/spodi index b3cf9013..6f92140d 100755 --- a/home-manager/packages/scripts/wrappers/spodi +++ b/home-manager/packages/scripts/wrappers/spodi @@ -4,16 +4,17 @@ . %SHELL_LIBRARY_PATH -DOWN_DIR=/home/dt/media/playlist/down/ +DOWN_DIR=/home/soispha/media/music/down/ -tmp=$(mktemp) -config=$(mktemp) +tmp=$(mktmp) +config=$(mktmp) + +fd . "$DOWN_DIR" --exclude spotdl.log > "$tmp"; -for e in "$DOWN_DIR"/*.mp3;do echo "$e" >> "$tmp";done cat << EO > "$config" --log-level INFO ---cache-path /home/dt/.config/spotdl/.spotipy +--cache-path /home/soispha/.config/spotdl/.spotipy --audio youtube-music youtube --lyrics genius musixmatch azlyrics --ffmpeg ffmpeg @@ -29,11 +30,10 @@ 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" +rm "${DOWN_DIR}spotdl.log" +cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" -unbuffer spotdl $(cat "$config") download "$1" | tee $DOWN_DIR/spotdl.log +# 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" [ -d ~/.spotdl ] && rm -r ~/.spotdl -rm "$tmp" -rm "$config" |