summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.go17
-rw-r--r--main.go4
2 files changed, 13 insertions, 8 deletions
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 {
diff --git a/main.go b/main.go
index 047769c..b6f4b83 100644
--- a/main.go
+++ b/main.go
@@ -109,7 +109,9 @@ func (ui *Ui) HandleInputs(gtx layout.Context) {
ui.State.PlayerContext, ui.State.PlayerCancel = context.WithCancel(context.Background())
var targets []net.HardwareAddr
for _, entry := range ui.State.Config.Soundboxes {
- targets = append(targets, net.HardwareAddr(entry.Mac))
+ if entry.Enabled {
+ targets = append(targets, net.HardwareAddr(entry.Mac))
+ }
}
go play(ui.State.PlayerContext, ui.State.UrlSelector.Value, targets, ui)
}