mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
TOOLS/mpv_identify.sh: simplify line-by-line reading
Use here-document idiom to read mpv output line-by-line.
This commit is contained in:
parent
6ef40cb910
commit
02d0b2f31c
@ -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 "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user