-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Promising snapcast, but needs lots of cleanup
- Loading branch information
Showing
9 changed files
with
478 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
internal "github.com/claes/regelverk/internal" | ||
) | ||
|
||
func main() { | ||
|
||
config, debug, dryRun := internal.ParseConfig() | ||
|
||
loops := []internal.ControlLoop{ | ||
&internal.SnapcastLoop{}, | ||
} | ||
|
||
bridgeWrappers := []internal.BridgeWrapper{ | ||
&internal.SnapcastBridgeWrapper{}, | ||
&internal.PulseaudioBridgeWrapper{}, | ||
} | ||
|
||
internal.StartRegelverk(config, loops, &bridgeWrappers, dryRun, debug) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package regelverk | ||
|
||
import ( | ||
"log/slog" | ||
|
||
snapcastmqtt "github.com/claes/snapcast-mqtt/lib" | ||
mqtt "github.com/eclipse/paho.mqtt.golang" | ||
) | ||
|
||
type SnapcastBridgeWrapper struct { | ||
bridge *snapcastmqtt.SnapcastMQTTBridge | ||
} | ||
|
||
func (l *SnapcastBridgeWrapper) InitializeBridge(mqttClient mqtt.Client, config Config) error { | ||
var err error | ||
snapConfig := snapcastmqtt.SnapClientConfig{SnapServerAddress: config.SnapcastServer} | ||
l.bridge, err = snapcastmqtt.NewSnapcastMQTTBridge(snapConfig, mqttClient, config.MQTTTopicPrefix) | ||
if err != nil { | ||
slog.Error("Could not create snapcast bridge", "error", err) | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (l *SnapcastBridgeWrapper) Run() error { | ||
go l.bridge.MainLoop() | ||
slog.Info("Snapcast bridge started") | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.