Skip to content

Instantly share code, notes, and snippets.

@NuckChorris
Created May 29, 2013 04:04
Show Gist options
  • Select an option

  • Save NuckChorris/5667894 to your computer and use it in GitHub Desktop.

Select an option

Save NuckChorris/5667894 to your computer and use it in GitHub Desktop.
#!/bin/zsh
while
read data
do
if [[ -z $(echo $data | cut -f 3 -d :) ]]; then
echo "$(tput setaf 3)[Error] $filename: bitrate not found$(tput sgr0)"
else
bitrate=$(echo $data | sed -r "s/.*,\s+([0-9]*) kbps.*/\1/")
filename=$(echo $data | cut -f 1 -d :)
if [ $bitrate -ne $bitrate ] 2>/dev/null; then
echo "$(tput setaf 3)[Error] $filename: bitrate not a number$(tput sgr0)"
elif (( $bitrate < $1 )); then
echo "$(tput setaf 1)[Bad] $filename @ $bitrate$(tput sgr0)"
else
echo "$(tput setaf 2)[Good] $filename @ $bitrate"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment