aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-06-30 17:05:16 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-06-30 18:09:46 +0200
commit51dbf50634fd3fd82f71cb1c64e0569c217828ae (patch)
tree66c56939d9e022fbf201a86c603d4850bd2524ec
parent7b8cb339a73d83e7a55d4ef3b60e16b24a42317a (diff)
downloadWRMS-51dbf50634fd3fd82f71cb1c64e0569c217828ae.tar.gz
WRMS-51dbf50634fd3fd82f71cb1c64e0569c217828ae.zip
cleanup Wrms._next
-rw-r--r--wrms.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/wrms.go b/wrms.go
index cac60db..8b292c8 100644
--- a/wrms.go
+++ b/wrms.go
@@ -299,6 +299,14 @@ func (wrms *Wrms) Next() {
func (wrms *Wrms) _next() {
llog.DDebug("Next Song")
+ cmd := "play"
+
+ // Terminate the mpv process playing the current song
+ if wrms.Player.mpv.Load() != nil {
+ wrms.Player.Stop()
+ cmd = "next"
+ }
+
next := wrms.queue.PopSong()
if next == nil {
wrms.CurrentSong.Store(nil)
@@ -318,13 +326,9 @@ func (wrms *Wrms) _next() {
}
}
- var cmd string
+ // We are playing -> start playing the next song
if wrms.Playing {
wrms.Player.Play(next)
- cmd = "play"
- } else if wrms.Player.mpv != nil {
- wrms.Player.terminateMpv()
- cmd = "next"
}
wrms.rwlock.Unlock()