aboutsummaryrefslogtreecommitdiff
path: root/wrms.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-08-01 22:13:32 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2022-08-01 22:13:32 +0200
commit5900302b27ef2ee45bfe14c7184f78706b863931 (patch)
treee6d18c20fbca0d8a34077f8eb54a3f99106ab501 /wrms.go
parent2b166cfb3bfb6eebd928564210330596bf1de45f (diff)
downloadWRMS-5900302b27ef2ee45bfe14c7184f78706b863931.tar.gz
WRMS-5900302b27ef2ee45bfe14c7184f78706b863931.zip
fix player initialization and broadcast logging
Diffstat (limited to 'wrms.go')
-rw-r--r--wrms.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/wrms.go b/wrms.go
index f8d0049..607798c 100644
--- a/wrms.go
+++ b/wrms.go
@@ -59,16 +59,16 @@ func (c *Connection) Close() {
type Wrms struct {
Connections []Connection
Songs []Song
- Queue Playlist
+ queue Playlist
CurrentSong Song
Player Player
Playing bool
}
-func NewWrms() Wrms {
+func NewWrms() *Wrms {
wrms := Wrms{}
wrms.Player = NewPlayer(&wrms)
- return wrms
+ return &wrms
}
func (wrms *Wrms) Close() {
@@ -79,7 +79,7 @@ func (wrms *Wrms) Close() {
}
func (wrms *Wrms) Broadcast(cmd Event) {
- llog.Info(fmt.Sprintf("Broadcasting %v"))
+ llog.Info(fmt.Sprintf("Broadcasting %v", cmd))
for i := 0; i < len(wrms.Connections); i++ {
wrms.Connections[i].Events <- cmd
}
@@ -88,12 +88,12 @@ func (wrms *Wrms) Broadcast(cmd Event) {
func (wrms *Wrms) AddSong(song Song) {
wrms.Songs = append(wrms.Songs, song)
s := &wrms.Songs[len(wrms.Songs)-1]
- wrms.Queue.Add(s)
+ wrms.queue.Add(s)
llog.Info(fmt.Sprintf("Added song %s (ptr=%p) to Songs", s.Uri, s))
}
func (wrms *Wrms) Next() {
- next := wrms.Queue.PopSong()
+ next := wrms.queue.PopSong()
if next == nil {
wrms.CurrentSong.Uri = ""
return
@@ -193,7 +193,7 @@ func (wrms *Wrms) AdjustSongWeight(connId string, songUri string, vote string) {
llog.Fatal("invalid vote")
}
- wrms.Queue.Adjust(s)
+ wrms.queue.Adjust(s)
wrms.Broadcast(Event{"update", []Song{*s}})
break
}