aboutsummaryrefslogtreecommitdiff
path: root/player.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-05-31 20:53:12 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-05-31 20:54:08 +0200
commit2a16dcba5a31a45a12853a15254719c357baae6d (patch)
tree92271c8ce54846e684cd874c8c2008651c3a9778 /player.go
parentd8bdce51c336f3693121202402ee38ff3f12c0e2 (diff)
downloadWRMS-2a16dcba5a31a45a12853a15254719c357baae6d.tar.gz
WRMS-2a16dcba5a31a45a12853a15254719c357baae6d.zip
use an atomic pointer to track the current song
Also fix showing finished songs as current playing on new clients.
Diffstat (limited to 'player.go')
-rw-r--r--player.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/player.go b/player.go
index db1936a..db4457c 100644
--- a/player.go
+++ b/player.go
@@ -68,12 +68,12 @@ func (player *Player) runMpv() {
llog.Fatal("Mpv failed with: %s", err.Error())
}
- wrms := player.wrms
+ currentSong := wrms.CurrentSong.Load()
llog.Info("mpv finished. Resetting mpv, and calling next")
player.mpv = nil
- player.Backends[wrms.CurrentSong.Source].OnSongFinished(&wrms.CurrentSong)
+ player.Backends[currentSong.Source].OnSongFinished(currentSong)
wrms.Next()
}