Search notes:

Script: mp3-prep

#!/bin/bash

if [[ "$#" < 2 ]]; then
  echo "mp3-prep mp3-file out-prefix"
  exit -1
fi

if ! command -v mp3splt; then
     echo "mp3-splt not found"
     exit 1
fi

if ! command -v mp3info; then
     echo "mp3info not found"
     exit 1
fi

mp3_file=$1
out_prefix=$2

if [[ ! -e "$mp3_file" ]]; then
  echo "$mp3_file" is not a file
  exit -1
fi

if [[ -e "$out_prefix" ]]; then
  echo "Directory $out_prefix already exists"
  exit -1
fi

mkdir $out_prefix
mv "$mp3_file" $out_prefix
cd $out_prefix

duration_minutes=$(mp3info -p "%m" "$mp3_file")
# echo duration_minutes: $duration_minutes

nof_splits=$(( ( $duration_minutes + 3 ) / 5 ))
# echo nof_splits: $nof_splits

mp3splt -f -S $nof_splits -o ${out_prefix}_@n "$mp3_file"

if command -v id3convert ; then
#
# Remove mp3 tags:
#
  id3convert -s ${out_prefix}_*.mp3
fi
Github repository scripts-and-utilities, path: /mp3-prep

See also

Scripts

Index