scripts: switch to using JsonUtils.match_rules_apply_properties()

Note: this requires all existing config files to be modified to follow
pipewire's rules syntax, with an "actions" object wrapping the
"update-props" object.
This commit is contained in:
George Kiagiadakis
2023-11-07 12:44:13 +02:00
parent fbecc50319
commit 299e671ffa
9 changed files with 189 additions and 157 deletions

View File

@@ -72,15 +72,15 @@ function cutils.get_default_metadata_object ()
end
function cutils.evaluateRulesApplyProperties (properties, name)
local matched, mprops = Conf.apply_rules (name, properties)
local section = Conf.get_section (name)
local matched, mprops = JsonUtils.match_rules_update_properties (
section, properties)
if (matched and mprops) then
if (matched > 0 and mprops) then
for k, v in pairs (mprops) do
properties [k] = v
end
end
return matched and mprops
end
-- simple serializer {"foo", "bar"} -> "foo;bar;"