]> git.plutz.net Git - serve0/commitdiff
cleaned up meta gnerator
authorpaul <paul@plutz.net>
Fri, 7 Aug 2015 16:47:41 +0000 (16:47 +0000)
committerpaul <paul@plutz.net>
Fri, 7 Aug 2015 16:47:41 +0000 (16:47 +0000)
svn path=/trunk/; revision=79

helpers/genmeta.sh

index 805bde13784287a2f2ff7e92ce3af525283fb354..c41c49155895a3f42550033084288594af6e1b0b 100755 (executable)
@@ -8,12 +8,15 @@ if [ -r "$meta" ]; then
   description="$(sed -n '3,$p' "$meta")"
 fi
 
-eval $(mplayer -noconsolecontrols -input file=/dev/null -slave -really-quiet -identify -frames 0 -ao null -vo null "$video" |sed -rn 's:ID_VIDEO_WIDTH=(.*):width=\1:p;s:ID_VIDEO_HEIGHT=(.*):height=\1:p;s:ID_LENGTH=(.*)(\..*)$:length=\1:p;')
-
-[ -z "$tags" ] && tags='|'
+mplayer -really-quiet -identify -frames 0 -nosound -vo null "$video" \
+| sed -rn 's:ID_VIDEO_WIDTH=(.*):\1:p;
+           s:ID_VIDEO_HEIGHT=(.*):\1:p;
+           s:ID_LENGTH=(.*)(\..*)$:\1:p;' \
+| tr '\n' ' ' \
+| read width height length
 
 cat <<EOF >"$meta"
-$length        $width  $height $(basename "$video")
-$tags
-$description
+${length:-0}   ${width:-0}     ${height:-0}    ${video##*/}
+${tags:-|}
+${description}
 EOF