load full queue state on start
This commit is contained in:
@@ -333,6 +333,11 @@ func (p *PlaybackManager) OnLoopModeChange(cb func(LoopMode)) {
|
||||
p.engine.onLoopModeChange = append(p.engine.onLoopModeChange, cb)
|
||||
}
|
||||
|
||||
// Registers a callback that is notified whenever the shuffle state changes.
|
||||
func (p *PlaybackManager) OnShuffleChange(cb func(bool)) {
|
||||
p.engine.onShuffleChange = append(p.engine.onShuffleChange, cb)
|
||||
}
|
||||
|
||||
// Registers a callback that is notified whenever the volume changes.
|
||||
func (p *PlaybackManager) OnVolumeChange(cb func(int)) {
|
||||
p.engine.onVolumeChange = append(p.engine.onVolumeChange, cb)
|
||||
@@ -400,6 +405,12 @@ func (p *PlaybackManager) LoadItems(items []mediaprovider.MediaItem, insertQueue
|
||||
p.cmdQueue.LoadItems(items, insertQueueMode, shuffle)
|
||||
}
|
||||
|
||||
// Load items into the currently active queue. (shuffledPlayQueue/playQueue)
|
||||
// If replacing the current queue (!appendToQueue), playback will be stopped.
|
||||
func (p *PlaybackManager) SetQueueState(tracks []*mediaprovider.Track, queueType QueueType) {
|
||||
p.cmdQueue.SetQueueState(tracks, queueType)
|
||||
}
|
||||
|
||||
// Replaces the play queue with the given set of tracks.
|
||||
// Does not stop playback if the currently playing track is in the new queue,
|
||||
// but updates the now playing index to point to the first instance of the track in the new queue.
|
||||
@@ -743,7 +754,7 @@ func (p *PlaybackManager) enqueueAutoplayTracks() {
|
||||
}
|
||||
|
||||
// last 500 played items
|
||||
queue := p.GetPlayQueue()
|
||||
queue := p.GetActivePlayQueue()
|
||||
if l := len(queue); l > 500 {
|
||||
queue = queue[l-500:]
|
||||
}
|
||||
@@ -858,6 +869,12 @@ func (p *PlaybackManager) runCmdQueue(ctx context.Context) {
|
||||
c.Arg3.(bool),
|
||||
)
|
||||
logIfErr("LoadItems", err)
|
||||
case cmdSetQueueState:
|
||||
err := p.engine.SetQueueState(
|
||||
c.Arg.([]*mediaprovider.Track),
|
||||
c.Arg2.(QueueType),
|
||||
)
|
||||
logIfErr("SetQueueState", err)
|
||||
case cmdLoadRadioStation:
|
||||
p.engine.LoadRadioStation(
|
||||
c.Arg.(*mediaprovider.RadioStation),
|
||||
|
||||
Reference in New Issue
Block a user