Create the interim folder and it subdirs for ffmpeg.

This commit is contained in:
Hyperling 2025-03-19 13:04:38 -07:00
parent ea9bcddfdc
commit 8b40fb3056

View File

@ -28,7 +28,7 @@ INT="INTERIM"
OLD_DIR="$DIR/$OLD" OLD_DIR="$DIR/$OLD"
NEW_DIR="$DIR/$NEW" NEW_DIR="$DIR/$NEW"
INT_DIR="$DIR/$INTERIM" INT_DIR="$DIR/$INT"
## Checks and Setup ## ## Checks and Setup ##
@ -74,13 +74,23 @@ mkdir -pv "$NEW_DIR" "$INT_DIR"
echo "* Ensure all files are mp3." echo "* Ensure all files are mp3."
find "$OLD_DIR" -type f ! -name "*".mp3 | sort | while read file; do find "$OLD_DIR" -type f ! -name "*".mp3 | sort | while read file; do
echo "** Working on '$file'." echo "** Working on '$file'."
TEMP_DIR="`dirname "$file"`"
TEMP_DIR="${TEMP_DIR//$OLD/$INT}"
echo "TEMP_DIR='$TEMP_DIR'"
mkdir -pv "$TEMP_DIR"
TEMP_FILE="`basename "$file"`"
TEMP_FILE="${TEMP_FILE//[^[:alnum:][:space:].]/}"
echo "$TEMP_FILE"
ffmpeg -y -nostdin -hide_banner -loglevel quiet -i "$file" \ ffmpeg -y -nostdin -hide_banner -loglevel quiet -i "$file" \
"${file//$OLD/$INTERIM}".converted.mp3 "${file//$OLD/$INT}".mp3
status="$?" status="$?"
if [[ $status != 0 ]]; then if [[ $status != 0 ]]; then
echo "*** FAILED: Exited with status '$status'." echo "*** FAILED: Exited with status '$status'."
echo "**** To troubleshoot, try running this:" echo "**** To troubleshoot, try running this:"
echo "ffmpeg -i \"$file\" \"$file\".converted.mp3" echo "ffmpeg -y -i \"$file\" \"${file//$OLD/$INT}\".mp3"
else else
echo "*** Success!" echo "*** Success!"
fi fi