From 7e15ad1d8af4ee27f6c1d31e7b1608e2d751c402 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 26 Jul 2022 21:37:24 +0200 Subject: intermediate commit * use mpv to play songs * fix CurrentSong being a pointer to a changing slot in the playlist array * wire up play and pause * continue playing after a song is finished --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 657b211..545c3b2 100644 --- a/main.go +++ b/main.go @@ -55,7 +55,7 @@ func genericVoteHandler(w http.ResponseWriter, r *http.Request, vote string) { connId := uuidCookie.Value songUri := r.URL.Query().Get("song") - log.Println("%s song %s via url %s", vote, songUri, r.URL) + log.Println(fmt.Sprintf("%s song %s via url %s", vote, songUri, r.URL)) wrms.AdjustSongWeight(connId, songUri, vote) } @@ -85,7 +85,7 @@ func addHandler(w http.ResponseWriter, r *http.Request) { return } - log.Println(fmt.Sprintf("Added song %s", string(data))) + log.Println("Added song", string(data)) wrms.AddSong(song) wrms.Broadcast(Event{"add", []Song{song}}) fmt.Fprintf(w, "Added song %s", string(data)) @@ -128,7 +128,7 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) { initialCmds := [][]byte{} if wrms.Playing { - data, err := json.Marshal(Event{"play", []Song{*wrms.CurrentSong}}) + data, err := json.Marshal(Event{"play", []Song{wrms.CurrentSong}}) if err != nil { log.Fatal(err) return -- cgit v1.2.3