about summary refs log tree commit diff stats
path: root/home-manager/packages/scripts/wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/packages/scripts/wrappers')
-rwxr-xr-xhome-manager/packages/scripts/wrappers/spodi20
1 files changed, 10 insertions, 10 deletions
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"