♻️ refactor(bin): notify-send calls are now made through a function in the downloadMusic script

This commit is contained in:
Sergio Laín 2024-01-07 18:09:54 +01:00
parent bcc80f632b
commit bd83f38ba4
No known key found for this signature in database
GPG key ID: 14C9B8080681777B

View file

@ -1,7 +1,11 @@
#!/usr/bin/bash #!/bin/bash
notify() {
notify-send "Spotdl Sync" "$1" --icon=spotify --app-name=spotify
}
if ! command -v spotdl &>/dev/null; then if ! command -v spotdl &>/dev/null; then
notify-send "Spotdl Sync" "Error: spotdl is not installed" --icon=spotify --app-name=spotify notify "Error: spotdl is not installed"
exit 1 exit 1
fi fi
@ -14,14 +18,14 @@ FOLDERS=(
"Cyberpunk-Darksynth" "Cyberpunk-Darksynth"
) )
notify-send "Spotdl Sync" "Started syncing..." --icon=spotify --app-name=spotify notify "Started syncing..."
for FOLDER in "${FOLDERS[@]}"; do for FOLDER in "${FOLDERS[@]}"; do
cd "$HOME/Musica/Listen-To/$FOLDER" || continue cd "$HOME/Musica/Listen-To/$FOLDER" || continue
spotdl sync "${FOLDER,,}.sync.spotdl" spotdl sync "${FOLDER,,}.sync.spotdl"
notify-send "Spotdl Sync" "$FOLDER synced" notify "$FOLDER synced"
done done
notify-send "Spotdl Sync Complete" notify "Spotdl Sync Complete"