From 9c6008e7f10d78b526b8bf4f8aab97e13bad4a22 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Fri, 12 Feb 2021 14:30:17 +0100 Subject: [PATCH] Change to new folder structure --- .../scripts/pieces/music-create-links.sh | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/arch-config/scripts/pieces/music-create-links.sh b/arch-config/scripts/pieces/music-create-links.sh index 0295ebbc..b67da999 100644 --- a/arch-config/scripts/pieces/music-create-links.sh +++ b/arch-config/scripts/pieces/music-create-links.sh @@ -8,31 +8,38 @@ rm -rf "$HOME/Musik/"* cd "$HOME/MusikRaw" # get directories -ls -d */ > directories +ls -d */ > artistdirectories -while read -r dir; do - # change into directory - cd "$dir" - # create directory in music - mkdir -p "$HOME/Musik/$dir" +while read -r artdir; do + cd "$artdir" + # get albums + ls -d */ > directories + while read -r dir; do + # change into directory + cd "$dir" + # create directory in music + mkdir -p "$HOME/Musik/${artdir}/$dir" - # link cover.jpg - if [[ -f cover.jpg ]]; then - ln -vf "$HOME/MusikRaw/$dir/cover."* "$HOME/Musik/$dir/" - fi + # link cover.jpg + if [[ -f cover.jpg ]]; then + ln -vf "$HOME/MusikRaw/${artdir}/$dir/cover."* "$HOME/Musik/${artdir}/$dir/" + fi - # make symbolic link to music - # if the "normalized" directory exists, links are created - if [[ -d "normalized" ]]; then - ln -svf "$HOME/MusikRaw/$dir/normalized/"* "$HOME/Musik/$dir/" - fi + # make symbolic link to music + # if the "normalized" directory exists, links are created + if [[ -d "normalized" ]]; then + ln -svf "$HOME/MusikRaw/${artdir}/$dir/normalized/"* "$HOME/Musik/${artdir}/$dir/" + fi - # go back to music raw + # go back to music raw + cd "$HOME/MusikRaw/$artdir" + done < directories + # cleanup + rm directories cd "$HOME/MusikRaw" -done < directories - -# remove directories file -rm directories +done < artistdirectories +# cleanup +rm artistdirectories echo Finished!