Remove comments

This commit is contained in:
RealStickman 2022-07-03 18:05:02 +02:00
parent 6f5c963886
commit b39c3407ba

View File

@ -7,22 +7,14 @@ cd "$HOME/MusikRaw"
# number of parallel jobs can be set on as an argument # number of parallel jobs can be set on as an argument
numjobs="$1" numjobs="$1"
# using find to get music that has to be transcoded
############################################################
############################## ##############################
##### OPUS ##### ##### OPUS #####
############################## ##############################
# find opus, ignore anything in "normalized" or "transcode" folders
#find "$HOME/MusikRaw/" -name "*\.opus" | grep -v "\/normalized\/" | grep -v "\/transcode\/" > opusfiles
# array of opus with find # array of opus with find
readarray -d '' opusfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.opus" -print0) readarray -d '' opusfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.opus" -print0)
for opus in "${opusfiles[@]}"; do for opus in "${opusfiles[@]}"; do
#while read -r opus; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -32,27 +24,19 @@ for opus in "${opusfiles[@]}"; do
cd "$pathname" cd "$pathname"
# convert file # convert file
ffmpeg-normalize "$opus" -v -pr -c:a libopus -b:a 128k -ext opus & ffmpeg-normalize "$opus" -v -pr -c:a libopus -b:a 128k -ext opus &
#done < opusfiles
done done
# go to musik raw folder # go to musik raw folder
cd "$HOME/MusikRaw" cd "$HOME/MusikRaw"
# cleanup
#rm opusfiles
############################## ##############################
##### M4A ##### ##### M4A #####
############################## ##############################
# find m4a files, ignore "normalized" or "transcode" folders
#find "$HOME/MusikRaw/" -name "*\.m4a" | grep -v "\/normalized\/" | grep -v "\/transcode\/" > m4afiles
# array of m4a with find # array of m4a with find
readarray -d '' m4afiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.m4a" -print0) readarray -d '' m4afiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.m4a" -print0)
for m4a in "${m4afiles[@]}"; do for m4a in "${m4afiles[@]}"; do
#while read -r m4a; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -62,27 +46,19 @@ for m4a in "${m4afiles[@]}"; do
cd "$pathname" cd "$pathname"
# convert file # convert file
ffmpeg-normalize "$m4a" -v -pr -c:a libopus -b:a 128k -ext opus & ffmpeg-normalize "$m4a" -v -pr -c:a libopus -b:a 128k -ext opus &
#done < m4afiles
done done
# go to musik raw folder # go to musik raw folder
cd "$HOME/MusikRaw" cd "$HOME/MusikRaw"
# cleanup
#rm m4afiles
############################## ##############################
##### FLAC ##### ##### FLAC #####
############################## ##############################
# find flac files, ignore "normalized" or "transcode" folders
#find "$HOME/MusikRaw/" -name "*\.flac" | grep -v "\/normalized\/" | grep -v "\/transcode\/" > flacfiles
# array of flac with find # array of flac with find
readarray -d '' flacfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.flac" -print0) readarray -d '' flacfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.flac" -print0)
for flac in "${flacfiles[@]}"; do for flac in "${flacfiles[@]}"; do
#while read -r flac; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -102,7 +78,6 @@ for flac in "${flacfiles[@]}"; do
# convert to opus in transcode directory # convert to opus in transcode directory
# TODO include cover picture (prefer file picture, cover.jpg second preference) # TODO include cover picture (prefer file picture, cover.jpg second preference)
ffmpeg -nostdin -i "$flac" -i cover.jpg -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" & ffmpeg -nostdin -i "$flac" -i cover.jpg -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" &
#done < flacfiles
done done
# wait for previous jobs to finish # wait for previous jobs to finish
@ -112,7 +87,6 @@ cd "$HOME/MusikRaw"
# convert previously transcoded flacs # convert previously transcoded flacs
for flac in "${flacfiles[@]}"; do for flac in "${flacfiles[@]}"; do
#while read -r flac; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -129,27 +103,19 @@ for flac in "${flacfiles[@]}"; do
# convert opus in transcode to normalized # convert opus in transcode to normalized
ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 384k -ext opus & ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 384k -ext opus &
#done < flacfiles
done done
# go to musik raw folder # go to musik raw folder
cd "$HOME/MusikRaw" cd "$HOME/MusikRaw"
# cleanup
#rm flacfiles
############################## ##############################
##### MP3 ##### ##### MP3 #####
############################## ##############################
# find mp3 files, ignore "normalized" or "transcode" folders
#find "$HOME/MusikRaw/" -name "*\.mp3" | grep -v "\/normalized\/" | grep -v "\/transcode\/" > mp3files
# array of mp3 with find # array of mp3 with find
readarray -d '' mp3files < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.mp3" -print0) readarray -d '' mp3files < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.mp3" -print0)
for mp3 in "${mp3files[@]}"; do for mp3 in "${mp3files[@]}"; do
#while read -r mp3; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -169,7 +135,6 @@ for mp3 in "${mp3files[@]}"; do
# convert to opus in transcode directory # convert to opus in transcode directory
# TODO include cover picture (prefer file picture, cover.jpg second preference) # TODO include cover picture (prefer file picture, cover.jpg second preference)
ffmpeg -nostdin -i "$mp3" -i cover.jpg -c:a libopus -b:a 192k "${pathname}/transcode/$opusfile" & ffmpeg -nostdin -i "$mp3" -i cover.jpg -c:a libopus -b:a 192k "${pathname}/transcode/$opusfile" &
#done < mp3files
done done
# wait for previous jobs to finish # wait for previous jobs to finish
@ -179,7 +144,6 @@ cd "$HOME/MusikRaw"
# convert previously transcoded mp3s # convert previously transcoded mp3s
for mp3 in "${mp3files[@]}"; do for mp3 in "${mp3files[@]}"; do
#while read -r mp3; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -196,27 +160,19 @@ for mp3 in "${mp3files[@]}"; do
# convert opus in transcode to normalized # convert opus in transcode to normalized
ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 192k -ext opus & ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 192k -ext opus &
#done < mp3files
done done
# go to musik raw folder # go to musik raw folder
cd "$HOME/MusikRaw" cd "$HOME/MusikRaw"
# cleanup
#rm mp3files
############################## ##############################
##### WAV ##### ##### WAV #####
############################## ##############################
# find wav files, ignore "normalized" or "transcode" folders
#find "$HOME/MusikRaw/" -name "*\.wav" | grep -v "\/normalized\/" | grep -v "\/transcode\/" > wavfiles
# array of wav with find # array of wav with find
readarray -d '' wavfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.wav" -print0) readarray -d '' wavfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.wav" -print0)
for wav in "${wavfiles[@]}"; do for wav in "${wavfiles[@]}"; do
#while read -r wav; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -236,7 +192,6 @@ for wav in "${wavfiles[@]}"; do
# convert to opus in transcode directory # convert to opus in transcode directory
# TODO include cover picture (prefer file picture, cover.jpg second preference) # TODO include cover picture (prefer file picture, cover.jpg second preference)
ffmpeg -nostdin -i "$wav" -i cover.jpg -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" & ffmpeg -nostdin -i "$wav" -i cover.jpg -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" &
#done < wavfiles
done done
# wait for previous jobs to finish # wait for previous jobs to finish
@ -246,7 +201,6 @@ cd "$HOME/MusikRaw"
# convert previously transcoded wavs # convert previously transcoded wavs
for wav in "${wavfiles[@]}"; do for wav in "${wavfiles[@]}"; do
#while read -r wav; do
# if there are $numjobs or more, dont spawn any new processes # if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
@ -263,17 +217,11 @@ for wav in "${wavfiles[@]}"; do
# convert opus in transcode to normalized # convert opus in transcode to normalized
ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 384k -ext opus & ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 384k -ext opus &
#done < wavfiles
done done
# go to musik raw folder # go to musik raw folder
cd "$HOME/MusikRaw" cd "$HOME/MusikRaw"
# cleanup
#rm wavfiles
############################################################
while [[ $(jobs | wc -l) -gt 1 ]] ; do sleep 1 ; done while [[ $(jobs | wc -l) -gt 1 ]] ; do sleep 1 ; done
echo Finished! echo Finished!