From 0dd945ae968e8d15e6adec71c5a598a39acf18dd Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 8 Oct 2024 20:46:45 +0200 Subject: Add config option "enabled" This allows to disable soundbox devices inside the configuration file. Thus the MAC address can be kept inside the config while the device does not have to be reachable during usage of the app. Later the GUI should be able to change this during runtime. --- config.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'config.go') diff --git a/config.go b/config.go index d04c423..44d6892 100644 --- a/config.go +++ b/config.go @@ -12,8 +12,9 @@ const configPathRelative = `.config/soundbox/config.json` type Config struct { Soundboxes []struct { - Name string - Mac net.HardwareAddr + Name string + Mac net.HardwareAddr + Enabled bool } URLs []struct { Name string @@ -24,8 +25,9 @@ type Config struct { func (config *Config) UnmarshalJSON(data []byte) error { var buffer struct { Soundboxes []struct { - Name string - Mac string + Name string + Mac string + Enabled bool } URLs []struct { Name string @@ -46,9 +48,10 @@ func (config *Config) UnmarshalJSON(data []byte) error { return err } parsed.Soundboxes = append(parsed.Soundboxes, struct { - Name string - Mac net.HardwareAddr - }{soundbox.Name, hwAddr}) + Name string + Mac net.HardwareAddr + Enabled bool + }{soundbox.Name, hwAddr, soundbox.Enabled}) } for _, url := range buffer.URLs { -- cgit v1.2.3-70-g09d2