diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-07-26 21:37:24 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-07-26 21:37:24 +0200 |
| commit | 7e15ad1d8af4ee27f6c1d31e7b1608e2d751c402 (patch) | |
| tree | 157a86cd3597d51b3fe72e73bd4e782bda07b2d0 /main.go | |
| parent | 8171af55daad6ce9a5cdacf95527801e83f25c08 (diff) | |
| download | WRMS-7e15ad1d8af4ee27f6c1d31e7b1608e2d751c402.tar.gz WRMS-7e15ad1d8af4ee27f6c1d31e7b1608e2d751c402.zip | |
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
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |
