aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-06-30 18:06:08 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-06-30 18:09:46 +0200
commit6173e6227f4af0ce43baab074070a2d5df2c8a98 (patch)
tree1a8dc4a693a24338580aa8b1feee6657499cf4de
parent1da552c5e9c0a110056537647b325e1107d8a6bb (diff)
downloadWRMS-6173e6227f4af0ce43baab074070a2d5df2c8a98.tar.gz
WRMS-6173e6227f4af0ce43baab074070a2d5df2c8a98.zip
remember the current song before waiting for mpv
-rw-r--r--player.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/player.go b/player.go
index 9ccd13f..0d4da86 100644
--- a/player.go
+++ b/player.go
@@ -89,6 +89,10 @@ func (player *Player) startMpv(uri string) *exec.Cmd {
}
func (player *Player) runMpv() {
+ // Remember the song we are playing
+ // TODO: This is potentially racy
+ currentSong := wrms.CurrentSong.Load()
+
mpv := player.mpv.Load()
output, err := mpv.CombinedOutput()
if err != nil {
@@ -99,7 +103,6 @@ func (player *Player) runMpv() {
}
}
- currentSong := wrms.CurrentSong.Load()
player.mpv.Store(nil)
player.Backends[currentSong.Source].OnSongFinished(currentSong)