merge conflicts

This commit is contained in:
Siiiiinth
2026-02-09 08:11:05 +01:00
56 changed files with 4364 additions and 369 deletions
+19
View File
@@ -8,6 +8,7 @@ import (
"math/rand"
"slices"
"strconv"
"strings"
"time"
"github.com/dweymouth/supersonic/backend/mediaprovider"
@@ -116,6 +117,8 @@ type playbackEngine struct {
onStopped []func()
onPlaying []func()
onQueueChange []func()
onRadioMetadataChange []func(radioName, title, artist string)
}
func NewPlaybackEngine(
@@ -845,6 +848,22 @@ func (p *playbackEngine) setTrack(idx int, next bool, startTime float64) error {
url = filepath
}
}
if mpvP, ok := p.player.(*mpv.Player); ok && !isTrack {
mpvP.ObserveIcyRadioTitle(func(icytitle string) {
var title, artist string
if s := strings.Split(icytitle, " - "); len(s) == 2 {
title, artist = s[1], s[0]
} else {
title = icytitle
}
log.Println("Radio metadata changed: ", icytitle)
for _, cb := range p.onRadioMetadataChange {
cb(meta.Name, title, artist)
}
})
} else if ok {
mpvP.UnobserveIcyRadioTitle()
}
if url == "" {
return errors.New("no stream URL")
}