[MPlayer-cvslog] CVS: main/TOOLS midentify,1.3,1.4
Tobias Diedrich CVS
syncmail at mplayerhq.hu
Thu Jun 30 02:46:23 CEST 2005
CVS change done by Tobias Diedrich CVS
Update of /cvsroot/mplayer/main/TOOLS
In directory mail:/var2/tmp/cvs-serv32709
Modified Files:
midentify
Log Message:
Better approach to shell escaping, may not catch all cases yet
Index: midentify
===================================================================
RCS file: /cvsroot/mplayer/main/TOOLS/midentify,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- midentify 12 Mar 2003 16:25:25 -0000 1.3
+++ midentify 30 Jun 2005 00:46:21 -0000 1.4
@@ -1,5 +1,16 @@
#!/bin/sh
+#
+# This is a wrapper around the -identify functionality.
+# It is supposed to escape the output properly, so it can be easily
+# used in shellscripts by 'eval'ing the output of this script.
+#
+# Written by Tobias Diedrich <ranma+mplayer at tdiedrich.de>
+# Licensed under GNU GPL.
+
+if [ -z "$1" ]; then
+ echo "Usage: midentify <file> [<file> ...]"
+ exit 1
+fi
+
mplayer -vo null -ao null -frames 0 -identify "$@" 2>/dev/null |
- grep "^ID" |
- sed -e 's/[`\\!$"]/\\&/g' |
- sed -e '/^ID_FILENAME/ { s/^ID_FILENAME=\(.*\)/ID_FILENAME="\1"/g; }'
+ sed -ne '/^ID_/ {s/[]`\\!$" []/\\&/g;p }'
More information about the MPlayer-cvslog
mailing list