Skip to content

Instantly share code, notes, and snippets.

@deckerego
Created December 6, 2013 22:10
Show Gist options
  • Save deckerego/7833003 to your computer and use it in GitHub Desktop.
Save deckerego/7833003 to your computer and use it in GitHub Desktop.
Check your Ogg Vorbis files and ensure they're not corrupted.
#!/bin/bash
BASEDIR=$1
if [ -z "$BASEDIR" ] ; then
echo "Usage: oggcheck directory"
exit -1
fi
if [ ! -d "$BASEDIR" ] ; then
echo "Directory $BASEDIR not found"
exit -1
fi
DIRLIST=`ls -1d "$BASEDIR/"*`
IFS="
"
for DIRECTORY in $DIRLIST ; do
[ ! -d "$DIRECTORY" ] && continue
OGGFILES=`ls -1d "$DIRECTORY/"*.ogg`
for OGGFILE in $OGGFILES ; do
WARNING=`ogginfo "$OGGFILE" | grep -E 'arning|bug'`
if [[ ! -z "$WARNING" ]] ; then
echo "$DIRECTORY is corrupt."
break
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment