diff --git a/src/scripts/linking/move-follow.lua b/src/scripts/linking/move-follow.lua index 47461d56..8af507f8 100644 --- a/src/scripts/linking/move-follow.lua +++ b/src/scripts/linking/move-follow.lua @@ -11,30 +11,6 @@ log = Log.open_topic ("s-linking") settings = require ("settings-linking") handles = {} -function handleFollowSetting (enable) - if (not handles.follow_hook) and (enable == true) then - handles.follow_hook = SimpleEventHook { - name = "linking/follow", - interests = { - EventInterest { - Constraint { "event.type", "=", "metadata-changed" }, - Constraint { "metadata.name", "=", "default" }, - Constraint { "event.subject.key", "c", "default.audio.source", - "default.audio.sink", "default.video.source" }, - }, - }, - execute = function (event) - local source = event:get_source () - source:call ("schedule-rescan", "linking") - end - } - handles.follow_hook:register () - elseif (handles.follow_hook) and (enable == false) then - handles.follow_hook:remove () - handles.follow_hook = nil - end -end - function handleMoveSetting (enable) if (not handles.move_hook) and (enable == true) then handles.move_hook = SimpleEventHook { @@ -58,8 +34,5 @@ function handleMoveSetting (enable) end end -settings:subscribe ("follow", handleFollowSetting) -handleFollowSetting (settings.follow) - settings:subscribe ("move", handleMoveSetting) handleMoveSetting (settings.move) diff --git a/src/scripts/linking/rescan.lua b/src/scripts/linking/rescan.lua index 505c4e15..8ce4cf84 100644 --- a/src/scripts/linking/rescan.lua +++ b/src/scripts/linking/rescan.lua @@ -179,6 +179,13 @@ SimpleEventHook { Constraint { "event.type", "=", "device-params-changed" }, Constraint { "event.subject.param-id", "=", "Route" }, }, + -- on any "default" target changed + EventInterest { + Constraint { "event.type", "=", "metadata-changed" }, + Constraint { "metadata.name", "=", "default" }, + Constraint { "event.subject.key", "c", "default.audio.source", + "default.audio.sink", "default.video.source" }, + }, }, execute = function (event) local source = event:get_source ()