summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorshdown <shdownnine@gmail.com>2014-09-16 20:23:04 +0400
committerwm4 <wm4@nowhere>2014-09-16 23:59:56 +0200
commit02d0b2f31ca49649c73e01438b85c29dda709fdb (patch)
tree08c4fa8ed273a009242f8ce3a4422c6df532b29f /TOOLS
parent6ef40cb91024b7d76694760a74fa2dd5b44025a1 (diff)
downloadmpv-02d0b2f31ca49649c73e01438b85c29dda709fdb.tar.bz2
mpv-02d0b2f31ca49649c73e01438b85c29dda709fdb.tar.xz
TOOLS/mpv_identify.sh: simplify line-by-line reading
Use here-document idiom to read mpv output line-by-line.
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/mpv_identify.sh24
1 files changed, 6 insertions, 18 deletions
diff --git a/TOOLS/mpv_identify.sh b/TOOLS/mpv_identify.sh
index 7b0848bffe..4d72198e99 100755
--- a/TOOLS/mpv_identify.sh
+++ b/TOOLS/mpv_identify.sh
@@ -97,25 +97,10 @@ __midentify__main() {
unset "$nextprefix$key"
done
- local output="$(${MPV:-mpv} --term-playing-msg="$propstr" --vo=null --ao=null \
- --frames=1 --quiet --no-cache --no-config -- "$@")"
local fileindex=0
local prefix=
- while :; do
- local line output
- case "$output" in
- '')
- break
- ;;
- *"$LF"*)
- line="${output%%$LF*}"
- output="${output#*$LF}"
- ;;
- *)
- line="$output"
- output=
- ;;
- esac
+ local line
+ while IFS= read -r line; do
case "$line" in
X-MIDENTIFY-START:)
if [ -n "$nextprefix" ]; then
@@ -154,7 +139,10 @@ __midentify__main() {
fi
;;
esac
- done
+ done <<EOF
+$(${MPV:-mpv} --term-playing-msg="$propstr" --vo=null --ao=null \
+ --frames=1 --quiet --no-cache --no-config -- "$@")
+EOF
}
__midentify__main "$@"