♻️ refactor(scripts): avoid harcoding values in downloadSpotify
This commit is contained in:
parent
b6cff14661
commit
7b92d12d42
1 changed files with 10 additions and 14 deletions
|
@ -9,23 +9,19 @@ if ! command -v spotdl &>/dev/null; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FOLDERS=(
|
MUSIC_FOLDER="$HOME/Musica/Listen-To"
|
||||||
"EDM-House"
|
|
||||||
"Metal-Rock"
|
|
||||||
"Synth-Chill"
|
|
||||||
"Lofi-Sleppy"
|
|
||||||
"Space-Cyberpunk"
|
|
||||||
"Cyberpunk-Darksynth"
|
|
||||||
)
|
|
||||||
|
|
||||||
notify "Started syncing..."
|
notify "Started syncing..."
|
||||||
|
|
||||||
for FOLDER in "${FOLDERS[@]}"; do
|
while IFS= read -r -d '' FOLDER; do
|
||||||
cd "$HOME/Musica/Listen-To/$FOLDER" || continue
|
FOLDER_NAME=$(basename "$FOLDER")
|
||||||
|
|
||||||
spotdl sync "${FOLDER,,}.spotdl"
|
SPOTDL_FILE=$(find "$FOLDER" -maxdepth 1 -type f -name '*.spotdl' -print -quit)
|
||||||
|
if [ -n "$SPOTDL_FILE" ]; then
|
||||||
notify "$FOLDER synced"
|
cd "$(dirname "$SPOTDL_FILE")" || continue
|
||||||
done
|
spotdl sync "$(basename "$SPOTDL_FILE")"
|
||||||
|
notify "Synced $FOLDER_NAME"
|
||||||
|
fi
|
||||||
|
done < <(find "$MUSIC_FOLDER" -mindepth 1 -maxdepth 1 -type d -print0)
|
||||||
|
|
||||||
notify "Spotdl Sync Complete"
|
notify "Spotdl Sync Complete"
|
||||||
|
|
Loading…
Add table
Reference in a new issue