All pastes #639929 Raw Edit

Miscellany

public text v1 · immutable
#639929 ·published 2007-07-30 23:09 UTC
rendered paste body
#!/bin/bash
for t in `ls .|grep txt`; do
# start with numerical comparisions
x=$(grep ^MaxBitRate "$t"|cut -d, -f2)
if (( $x < 4000000 ))
then
     grep ^MaxBitRate "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'Stream(1)DataBitRate' "$t"|cut -d, -f2)
if (( $x > 96000 ))
then
     grep ^'Stream(1)DataBitRate' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'Stream(2)DataBitRate' "$t"|cut -d, -f2)
if (( $x > 1200000 ))
then
     grep ^'Stream(2)DataBitRate' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'Stream(2)AlternateDataBitrate' "$t"|cut -d, -f2)
if (( $x > 4000000 ))
then
     grep ^'Stream(2)AlternateDataBitrate' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^SamplesPerSecond "$t"|cut -d, -f2)
if (( $x < 32000 ))
then
     grep ^SamplesPerSecond "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^BitsPerPixelCount "$t"|cut -d, -f2)
if (( $x != 24 ))
then
     grep ^BitsPerPixelCount "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^EncodedImageWidth "$t"|cut -d, -f2)
if (( $x != 720 ))
then
     grep ^EncodedImageWidth "$t" >> /opt/gavin/bash/errors/"$t".error
fi



# second are tests to see if string exits, any string is printed as "astring" so "" means empty, which is bad
x=$(grep ^Title "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^Title "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^Author "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^Author "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^Copyright "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^Copyright "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^Description "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^Description "$t" >> /opt/gavin/bash/errors/"$t".error
fi


x=$(grep ^Rating "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^Rating "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^WMFSDKVersion "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^WMFSDKVersion "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^WMFSDKNeeded "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^WMFSDKNeeded "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'ID3/tempFileName' "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^'ID3/tempFileName' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'ID3/BASENAME' "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^'ID3/BASENAME' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'WM/Year' "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^'WM/Year' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'WM/ParentalRating' "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^'WM/ParentalRating' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^FileSize "$t"|cut -d, -f2)
if [[ $x = '""' ]]
then
    grep ^FileSize "$t" >> /opt/gavin/bash/errors/"$t".error
fi

#third are exact string matches
x=$(grep ^'"WM/ContentDistributor"' "$t"|cut -d, --fields=2,3)
if [[ $x != '"Movielink, LLC"' ]]
then
    grep ^'"WM/ContentDistributor"' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^AudioCodecName "$t"|cut -d, -f2)
if [[ $x != '"Windows Media Audio 9"' && $x != '"Windows Media Audio 9.1"' && $x != '"Windows Media Audio 9.2"' ]]
then
    grep ^AudioCodecName "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^VideoCodecName "$t"|cut -d, -f2)
if [[ $x != '"Windows Media Video 9"' ]]
then
    grep ^VideoCodecName "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'"Stream(1)IsVBR"' "$t"|cut -d, -f2)
if [[ $x != 'true' ]]
then
    grep ^'"Stream(1)IsVBR"' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'"Stream(1)DeviceConformanceTemplate"' "$t"|cut -d, --fields=2,3)
if [[ $x != '"L1"' && $x != '"L2"' && $x != '"L3"' ]]
then
    grep ^'"Stream(1)DeviceConformanceTemplate"' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'"Stream(2)IsVBR"' "$t"|cut -d, -f2)
if [[ $x != 'true' ]]
then
    grep ^'"Stream(2)IsVBR"' "$t" >> /opt/gavin/bash/errors/"$t".error
fi

x=$(grep ^'"Stream(2)DeviceConformanceTemplate"' "$t"|cut -d, -f2)
if [[ $x != '"MP@ML"' ]]
then
    grep ^'"Stream(2)DeviceConformanceTemplate"' "$t" >> /opt/gavin/bash/errors/"$t".error
fi; done



# This is a script to get the metadata on a title, then test if certain values are correct
# I used a perl script Neal suggested to generate list of titles from the inventory.xml file on a cds
# I then cleaned it up so that only the titles were listed by name, one per line
# I then sorted this list, sorted_list is the resulting file
#dir=/opt/gavin/check_metadata/ on hitman
#p=/usr/local/bin/mlasfview  this is the program to generate the ~90 line header textfile from a movie
# each line has 1 name,value pair