#cat x3 #!/bin/bash # 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 96 line header textfile from a movie # each line has 1 name.value pair #Below I establish the correct values expected for each name,value pair in the 96 line header generated #I start by doing the test on babel.txt, the header file for the title babel, later I will generalize n1=MaxBitRate t1=babel.txt v1=4000000 n2=Title n3=Author n4=Copyright n5=Description n6=Rating n7=WMFSDKVersion n8=WMFSDKNeeded n9="ID3/tempFileName" n10="ID3/BASENAME" n11="WM/Year" n12="WM/ParentalRating" n13="WM/ContentDistributor" v13="Movielink, LLC" n14=AudioCodecName v14="\"Windows Media Audio 9.1\"" n15=VideoCodecName v15="\"Windows Media Video 9\"" n16=FileSize n17="Stream(1)IsVBR" v17=FALSE n18="Stream(1)DeviceConformanceTemplate" v18="L2, L3" n19="Stream(2)IsVBR" v19=TRUE n20="Stream(2)DeviceConformanceTemplate" v20=MP@ML n21="Stream(1)DataBitRate" v21=96000 n22="Stream(2)DataBitRate" v22=1200000 n23="Stream(2)AlternateDataBitrate" v23=4000000 n24=SamplesPerSecond v24=32000 n25=BitsPerPixelCount v25=24 n26=EncodedImageWidth v26=720 #v2= (not needed since we are testing for (non)existance of string here) #test the name,value pairs as they appear in the spreadsheet for acceptable values # so far I have this working on babel.txt; the header for babel for i in {2..12} 16; do foo=$(grep ^$n"$i" $t1); [[ ${foo##*,} = \"\" || -z ${foo##*,} ]] && echo "$foo" >> "$t1.error"; done for i in {13..15} {17..20}; do foo=$(grep ^$n"$i" $t1); [[ ${foo##*,} != $v"$i" ]] && echo "$foo" >> "$t1.error"; done for i in 1 {21..23}; do foo=$(grep ^$n"$i" $t1); (( ${foo##*,} > $v"$i")) && echo "$foo" >> "$t1.error"; done foo=$(grep ^$n24 $t1); (( ${foo##*,} < $v24)) && echo "$foo" >> "$t1.error" for i in 25 26; do foo=$(grep ^$n"$i" $t1); (( ${foo##*,} != $v"$i")) && echo "$foo" >> "$t1.error"; done "x3" 60L, 2145C written [root@damserver check_metadata]# rm -f babel.txt.error [root@damserver check_metadata]# ./x3 ./x3: line 58: ((: > 1: syntax error: operand expected (error token is "> 1") ./x3: line 58: ((: > 21: syntax error: operand expected (error token is "> 21") ./x3: line 58: ((: > 22: syntax error: operand expected (error token is "> 22") ./x3: line 58: ((: > 23: syntax error: operand expected (error token is "> 23") ./x3: line 60: ((: != 25: syntax error: operand expected (error token is "!= 25") ./x3: line 60: ((: != 26: syntax error: operand expected (error token is "!= 26") #cat babel.txt: FileName,"/assets/1-COMPLETE/Babel_2006/wmv/4D9EE0BF-280E-4900-8090-1DC0FA305608/Babel_2006.wmv" Title,"Babel" Author,"Paramount Vantage" Copyright,"TM&Copyright 2007 by Paramount Pictures. All Rights Reserved." Description,"Tragedy strikes a vacationing married couple, causing a ripple effect in many people's lives. " Rating,"R" "WMFSDKVersion","10.00.00.3708" "WMFSDKNeeded","0.0.0.0000" "VBR Peak",134922328 "IsVBR",true "ASFLeakyBucketPairs","byte array" "Buffer Average",134922328 "ID3/tempFileName","Babel_2006" "ID3/BASENAME","Babel_2006" "WM/Year","2006" "WM/ParentalRating","R" "ID3/BITRATE","1200000" "ID3/QUALITY","Smoothest" "ID3/DISPTYPE","Standard" "ID3/VERSION","1" "WM/ContentDistributor","Movielink, LLC" AudioCodecName,"Windows Media Audio 9.1" AudioCodecDescription," 96 kbps, 48 kHz, stereo (A/V) 2-pass CBR" VideoCodecName,"Windows Media Video 9" VideoCodecDescription,"" FileIdentifier,{E35FBD66-17A9-47D0-8576D8FDEC928D6B} FileSize,1401995575 Preroll,10000 PlayDuration,02:23:39 SendDuration,02:23:39 DataPacketsCount,87621 MinDataPacketSize,16000 MaxDataPacketSize,16000 MaxBitRate,4114782 "Stream(1)IsVBR",true "Stream(1)DeviceConformanceTemplate","L2" "Stream(1)WM/WMADRCPeakReference",134922696 "Stream(1)WM/WMADRCAverageReference",134922696 "Stream(2)IsVBR",true "Stream(2)DeviceConformanceTemplate","MP@ML" Stream(1)StartTime,0 Stream(1)EndTime,0 Stream(1)DataBitRate,96000 Stream(1)BufferSize,1451 Stream(1)InitialBufferFullness,0 Stream(1)AlternateDataBitrate,96000 Stream(1)AlternateBufferSize,1451 Stream(1)AlternateInitialBufferFullness,0 Stream(1)MaximumObjectSize,2048 Stream(1)Flags,2 Stream(1)StreamNumber,1 Stream(1)StreaLanguageIDIndex,0 Stream(1)AverageTimePerFrame(ms),170 Stream(1)AverageFramesPerSecond,5 Stream(1)StreamNameCount,0 Stream(1)PayloadExtensionSystemCount,0 Stream(2)StartTime,0 Stream(2)EndTime,0 Stream(2)DataBitRate,1200000 Stream(2)BufferSize,680861 Stream(2)InitialBufferFullness,0 Stream(2)AlternateDataBitrate,4000000 Stream(2)AlternateBufferSize,10000 Stream(2)AlternateInitialBufferFullness,0 Stream(2)MaximumObjectSize,101668 Stream(2)Flags,2 Stream(2)StreamNumber,2 Stream(2)StreaLanguageIDIndex,0 Stream(2)AverageTimePerFrame(ms),41 Stream(2)AverageFramesPerSecond,24 Stream(2)StreamNameCount,0 Stream(2)PayloadExtensionSystemCount,1 StreamType,Audio TimeOffset,0 CodecID,353 NumberOfChannels,2 BitPerSample,16 SamplesPerSecond,48000 AverageNumberOfBytesPerSecond,12000 BlockAlignment,2048 StreamType,Video TimeOffset,0 CompressionID,861293911 ImportantColorsCount,0 BitsPerPixelCount,24 ColorsUserCount,0 EncodedImageWidth,720 EncodedImageHeight,406 VerticalPixelsPerMeter,0 HorizontalPixelsPerMeters,0 ImageWidth,720 ImageHeight,406 ImageSize,0 Stream(1)AverageBitrate,99870 Stream(2)AverageBitrate,4014912 [root@damserver check_metadata]# ./x3 ./x3: line 60: ((: > 1: syntax error: operand expected (error token is "> 1") ./x3: line 60: ((: > 21: syntax error: operand expected (error token is "> 21") ./x3: line 60: ((: > 22: syntax error: operand expected (error token is "> 22") ./x3: line 60: ((: > 23: syntax error: operand expected (error token is "> 23") ./x3: line 62: ((: != 25: syntax error: operand expected (error token is "!= 25") ./x3: line 62: ((: != 26: syntax error: operand expected (error token is "!= 26")