2021-01-22 14:46:18 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2021-01-22 15:12:38 +01:00
|
|
|
# remove content of music directory
|
|
|
|
rm -rf "$HOME/Musik/"*
|
|
|
|
|
2021-01-22 14:46:18 +01:00
|
|
|
# change into music raw folder
|
|
|
|
cd "$HOME/MusikRaw"
|
|
|
|
|
|
|
|
# get directories
|
|
|
|
ls -d */ > directories
|
|
|
|
|
|
|
|
while read -r dir; do
|
|
|
|
# change into directory
|
|
|
|
cd "$dir"
|
|
|
|
# create directory in music
|
|
|
|
mkdir -p "$HOME/Musik/$dir"
|
|
|
|
|
|
|
|
# link cover.jpg
|
|
|
|
if [[ -f cover.jpg ]]; then
|
|
|
|
ln -vf "$HOME/MusikRaw/$dir/cover."* "$HOME/Musik/$dir/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# make symbolic link to music
|
2021-01-26 08:40:25 +01:00
|
|
|
# if the "normalized" directory exists, links are created
|
|
|
|
if [[ -d "normalized" ]]; then
|
|
|
|
ln -svf "$HOME/MusikRaw/$dir/normalized/"* "$HOME/Musik/$dir/"
|
|
|
|
fi
|
2021-01-26 08:42:56 +01:00
|
|
|
|
2021-01-22 14:46:18 +01:00
|
|
|
# go back to music raw
|
|
|
|
cd "$HOME/MusikRaw"
|
|
|
|
done < directories
|
|
|
|
|
|
|
|
# remove directories file
|
|
|
|
rm directories
|
|
|
|
|
|
|
|
echo Finished!
|
|
|
|
|
|
|
|
exit
|