Script for going through every directory in MusikRaw and linking to Musik
This commit is contained in:
parent
930b970c55
commit
df5fd79628
40
arch-config/scripts/pieces/multi-ffmpeg.sh
Normal file
40
arch-config/scripts/pieces/multi-ffmpeg.sh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
#change into music raw folder
|
||||
cd "$HOME/MusikRaw"
|
||||
|
||||
numjobs="$1"
|
||||
|
||||
# get directories
|
||||
#ls -d */ | awk '{gsub(/ /,"\\ ")}8' - > directories
|
||||
ls -d */ > directories
|
||||
|
||||
while read -r dir; do
|
||||
echo "$dir"
|
||||
# if there are $numjobs or more, dont spawn any new processes
|
||||
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
|
||||
cd "$dir"
|
||||
# convert m4a
|
||||
if [[ $(ls | grep ".m4a") ]]; then
|
||||
ffmpeg-normalize *.m4a -v -pr -c:a libopus -ext opus &
|
||||
fi
|
||||
# convert flac
|
||||
if [[ $(ls | grep ".flac") ]]; then
|
||||
ffmpeg-normalize *.flac -v -pr -c:a flac -ext flac &
|
||||
fi
|
||||
# convert opus
|
||||
if [[ $(ls | grep ".opus") ]]; then
|
||||
ffmpeg-normalize *.opus -v -pr -c:a libopus -ext opus &
|
||||
fi
|
||||
cd "$HOME/MusikRaw"
|
||||
# create directory
|
||||
mkdir -p "$HOME/Musik/$dir"
|
||||
# make symbolic link to music
|
||||
ln -svf "$HOME/MusikRaw/$dir/normalized/"* "$HOME/Musik/$dir/"
|
||||
done < directories
|
||||
|
||||
# remove directories file
|
||||
rm directories
|
||||
|
||||
exit
|
Loading…
Reference in New Issue
Block a user