summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-30 00:46:21 +0000
committerranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-06-30 00:46:21 +0000
commitb8bf49ab7c95dc884b34df72a688ac241a2dcffc (patch)
tree648494e7ed5b33ad45623b12211617e8fa94fda9 /TOOLS
parent19b8b75d9ece8e6ee859ca2c029bd4218db534ed (diff)
downloadmpv-b8bf49ab7c95dc884b34df72a688ac241a2dcffc.tar.bz2
mpv-b8bf49ab7c95dc884b34df72a688ac241a2dcffc.tar.xz
Better approach to shell escaping, may not catch all cases yet
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15858 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-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 }'