♻️ refactor(script): downloadSpotify filters subdirectories as well as base folders
This commit is contained in:
parent
053d15ed18
commit
b3bb6cf150
1 changed files with 4 additions and 6 deletions
|
@ -13,15 +13,13 @@ MUSIC_FOLDER="$HOME/Musica/Listen-To"
|
||||||
|
|
||||||
notify "Started syncing..."
|
notify "Started syncing..."
|
||||||
|
|
||||||
while IFS= read -r -d '' FOLDER; do
|
while IFS= read -r -d '' SPOTDL_FILE; do
|
||||||
FOLDER_NAME=$(basename "$FOLDER")
|
if [[ -f "$SPOTDL_FILE" && "$SPOTDL_FILE" == *.spotdl ]]; then
|
||||||
|
FOLDER_NAME=$(basename "$(dirname "$SPOTDL_FILE")")
|
||||||
SPOTDL_FILE=$(find "$FOLDER" -maxdepth 1 -type f -name '*.spotdl' -print -quit)
|
|
||||||
if [ -n "$SPOTDL_FILE" ]; then
|
|
||||||
cd "$(dirname "$SPOTDL_FILE")" || continue
|
cd "$(dirname "$SPOTDL_FILE")" || continue
|
||||||
spotdl sync "$(basename "$SPOTDL_FILE")"
|
spotdl sync "$(basename "$SPOTDL_FILE")"
|
||||||
notify "Synced $FOLDER_NAME"
|
notify "Synced $FOLDER_NAME"
|
||||||
fi
|
fi
|
||||||
done < <(find "$MUSIC_FOLDER" -mindepth 1 -maxdepth 1 -type d -print0)
|
done < <(find "$MUSIC_FOLDER" -mindepth 1 -maxdepth 3 -type f -name '*.spotdl' -print0)
|
||||||
|
|
||||||
notify "Spotdl Sync Complete"
|
notify "Spotdl Sync Complete"
|
||||||
|
|
Loading…
Add table
Reference in a new issue