summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xTOOLS/midentify17
1 files changed, 14 insertions, 3 deletions
diff --git a/TOOLS/midentify b/TOOLS/midentify
index f6dbf21be3..99fe723631 100755
--- a/TOOLS/midentify
+++ b/TOOLS/midentify
@@ -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@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 }'