endless-queue-management
Installation
SKILL.md
Endless queue management
An endlessly extending queue starts as a finite list (an album, a playlist) and then grows: when the source's continuation runs out and the "keep playing" setting is on, the app derives a follow-on source from the last track and appends to the same queue.
That gives the queue state two kinds of write, and they must not be the same function:
// Path 1 — the setter. A NEW queue: replaces the data and recomputes what is derived from it.
override fun setQueueData(data: QueueData.Data) {
_queueData.update { it.copy(data = data) }
player.albumTrackIds = // derived snapshot, recomputed here
if (data.playlistType == PlaylistType.ALBUM) data.listTracks.map { it.trackId }.toSet()
else emptySet()
}