mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 18:14:33 +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:
parent
fa9c2a35dd
commit
a7357c221e
@ -94,7 +94,7 @@ EOF
|
|||||||
local key
|
local key
|
||||||
for key in $allprops; do
|
for key in $allprops; do
|
||||||
propstr="${propstr}X-MIDENTIFY: $key \${=$key}$LF"
|
propstr="${propstr}X-MIDENTIFY: $key \${=$key}$LF"
|
||||||
key="$(printf '%s\n' "$key" | tr - _)"
|
key="$(printf '%s\n' "$key" | tr /- __)"
|
||||||
unset "$nextprefix$key"
|
unset "$nextprefix$key"
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ EOF
|
|||||||
fileindex="$((fileindex+1))"
|
fileindex="$((fileindex+1))"
|
||||||
nextprefix="${nextprefix}${fileindex}_"
|
nextprefix="${nextprefix}${fileindex}_"
|
||||||
for key in $allprops; do
|
for key in $allprops; do
|
||||||
key="$(printf '%s\n' "$key" | tr - _)"
|
key="$(printf '%s\n' "$key" | tr /- __)"
|
||||||
unset "$nextprefix$key"
|
unset "$nextprefix$key"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@ -126,7 +126,7 @@ EOF
|
|||||||
local key="${line#X-MIDENTIFY: }"
|
local key="${line#X-MIDENTIFY: }"
|
||||||
local value="${key#* }"
|
local value="${key#* }"
|
||||||
key="${key%% *}"
|
key="${key%% *}"
|
||||||
key="$(printf '%s\n' "$key" | tr - _)"
|
key="$(printf '%s\n' "$key" | tr /- __)"
|
||||||
if [ -n "$nextprefix" ]; then
|
if [ -n "$nextprefix" ]; then
|
||||||
if [ -z "$prefix" ]; then
|
if [ -z "$prefix" ]; then
|
||||||
echo >&2 "Got X-MIDENTIFY: without X-MIDENTIFY-START:"
|
echo >&2 "Got X-MIDENTIFY: without X-MIDENTIFY-START:"
|
||||||
|
Loading…
Reference in New Issue
Block a user