Skip to content
Snippets Groups Projects
Commit 4ae15a14 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

monitors: sanitize node names to match media-session's behavior

parent e92351b2
No related branches found
No related tags found
No related merge requests found
......@@ -114,6 +114,9 @@ function createNode(parent, id, type, factory, properties)
.. "." ..
profile
-- sanitize name
name = name:gsub("([^%w_%-%.])", "_")
properties["node.name"] = name
-- deduplicate nodes with the same name
......@@ -127,10 +130,12 @@ function createNode(parent, id, type, factory, properties)
end
-- and a nick
properties["node.nick"] = properties["node.nick"]
local nick = properties["node.nick"]
or dev_props["device.nick"]
or dev_props["api.alsa.card.name"]
or dev_props["alsa.card_name"]
-- also sanitize nick, but allow all characters except :
properties["node.nick"] = nick:gsub("(:)", "_")
-- ensure the node has a description
if not properties["node.description"] then
......
......@@ -56,11 +56,13 @@ function createNode(parent, id, type, factory, properties)
or "bluetooth-device"
-- set the node name
properties["node.name"] =
local name =
((factory:find("sink") and "bluez_output") or
(factory:find("source") and "bluez_input" or factory)) .. "." ..
(properties["api.bluez5.address"] or dev_props["device.name"]) .. "." ..
(properties["api.bluez5.profile"] or "unknown")
-- sanitize name
properties["node.name"] = name:gsub("([^%w_%-%.])", "_")
-- set priority
if not properties["priority.driver"] then
......
......@@ -68,6 +68,9 @@ function createNode(parent, id, type, factory, properties)
dev_props["device.alias"] or
"v4l2-device")
-- sanitize name
name = name:gsub("([^%w_%-%.])", "_")
properties["node.name"] = name
-- deduplicate nodes with the same name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment