dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

mp3-find-broken (531B)


      1 #!/bin/sh
      2 # Finds broken MP3s, via mp3val.
      3 die() { printf "%s\n" "$1" >&2; exit 1; }
      4 command -v mp3val 1>/dev/null 2>&1 || die "mp3val not installed."
      5 [ $# -eq 1 ] || die "Argument required: path to music directory"
      6 [ -d "$1" ] || die "Path $1 is not a directory."
      7 set -x
      8 cd "$1" || die "Could not cd to $1"
      9 
     10 outfile=/tmp/mp3-find-broken-$RANDOM.log
     11 find . -name "*.mp3" | \
     12   while read -r fil; do
     13     mp3val "$fil" | grep '^WARNING' >/dev/null && printf "%s" "$fil" | tee -a "$fil"
     14   done
     15 
     16 printf "Log saved in %s.\n" "$outfile"