1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-11 08:37:59 +00:00

TOOLS/mpv_identify.sh: handle forward slash in property names

Property names contain '-' characters, which are translated into
underscores because POSIX shell variables cannot contain hyphens.

We should do the same thing for forward slash characters (i.e. '/')
because these also cannot be present in the names of shell variables.

Fixes: #15782
This commit is contained in:
Leo Izen 2025-01-31 20:40:24 -05:00 committed by Kacper Michajłow
parent fa9c2a35dd
commit a7357c221e

View File

@ -94,7 +94,7 @@ EOF
local key
for key in $allprops; do
propstr="${propstr}X-MIDENTIFY: $key \${=$key}$LF"
key="$(printf '%s\n' "$key" | tr - _)"
key="$(printf '%s\n' "$key" | tr /- __)"
unset "$nextprefix$key"
done
@ -112,7 +112,7 @@ EOF
fileindex="$((fileindex+1))"
nextprefix="${nextprefix}${fileindex}_"
for key in $allprops; do
key="$(printf '%s\n' "$key" | tr - _)"
key="$(printf '%s\n' "$key" | tr /- __)"
unset "$nextprefix$key"
done
else
@ -126,7 +126,7 @@ EOF
local key="${line#X-MIDENTIFY: }"
local value="${key#* }"
key="${key%% *}"
key="$(printf '%s\n' "$key" | tr - _)"
key="$(printf '%s\n' "$key" | tr /- __)"
if [ -n "$nextprefix" ]; then
if [ -z "$prefix" ]; then
echo >&2 "Got X-MIDENTIFY: without X-MIDENTIFY-START:"