Documentation
¶
Index ¶
- Constants
- func ContextTrackComparator(typ librespot.SpotifyIdType, target *connectpb.ContextTrack) func(*connectpb.ContextTrack) bool
- func ProvidedTrackComparator(typ librespot.SpotifyIdType, target *connectpb.ProvidedTrack) func(*connectpb.ContextTrack) bool
- type ContextResolver
- type List
- func (tl *List) AddToQueue(track *connectpb.ContextTrack)
- func (tl *List) AllTracks(max int) []*connectpb.ProvidedTrack
- func (tl *List) CurrentTrack() *connectpb.ProvidedTrack
- func (tl *List) GoNext(ctx context.Context) bool
- func (tl *List) GoPrev() bool
- func (tl *List) GoStart(ctx context.Context) bool
- func (tl *List) Index() *connectpb.ContextIndex
- func (tl *List) Metadata() map[string]string
- func (tl *List) NextTracks(ctx context.Context, nextHint []*connectpb.ContextTrack) []*connectpb.ProvidedTrack
- func (tl *List) PeekNext(ctx context.Context) *connectpb.ContextTrack
- func (tl *List) PrevTracks() []*connectpb.ProvidedTrack
- func (tl *List) Seek(ctx context.Context, f func(*connectpb.ContextTrack) bool) error
- func (tl *List) SetPlayingQueue(val bool)
- func (tl *List) SetQueue(_ []*connectpb.ContextTrack, next []*connectpb.ContextTrack)
- func (tl *List) Snapshot(ctx context.Context, nextHint []*connectpb.ContextTrack) *Snapshot
- func (tl *List) ToggleShuffle(ctx context.Context, shuffle bool) error
- func (tl *List) TrySeek(ctx context.Context, f func(track *connectpb.ContextTrack) bool) error
- func (tl *List) TrySeekTo(ctx context.Context, track *connectpb.ContextTrack) error
- func (tl *List) UpcomingQueue() []*connectpb.ContextTrack
- type Snapshot
Constants ¶
const MaxTracksInContext = 32
Variables ¶
This section is empty.
Functions ¶
func ContextTrackComparator ¶
func ContextTrackComparator(typ librespot.SpotifyIdType, target *connectpb.ContextTrack) func(*connectpb.ContextTrack) bool
func ProvidedTrackComparator ¶
func ProvidedTrackComparator(typ librespot.SpotifyIdType, target *connectpb.ProvidedTrack) func(*connectpb.ContextTrack) bool
Types ¶
type ContextResolver ¶ added in v0.9.0
type ContextResolver interface {
librespot.PageResolver[*connectpb.ContextTrack]
Type() librespot.SpotifyIdType
Uri() string
Metadata() map[string]string
}
type List ¶
type List struct {
// contains filtered or unexported fields
}
func NewTrackListFromContext ¶
func (*List) AddToQueue ¶
func (tl *List) AddToQueue(track *connectpb.ContextTrack)
func (*List) AllTracks ¶ added in v0.1.1
func (tl *List) AllTracks(max int) []*connectpb.ProvidedTrack
AllTracks returns the tracks already loaded, oldest first, keeping at most the last max of them. It never fetches: its one caller seeds an autoplay station with recently played tracks, and is reached by having run out of context — so whatever is still unfetched is by definition not recent.
func (*List) CurrentTrack ¶
func (tl *List) CurrentTrack() *connectpb.ProvidedTrack
func (*List) Index ¶
func (tl *List) Index() *connectpb.ContextIndex
func (*List) NextTracks ¶
func (tl *List) NextTracks(ctx context.Context, nextHint []*connectpb.ContextTrack) []*connectpb.ProvidedTrack
func (*List) PrevTracks ¶
func (tl *List) PrevTracks() []*connectpb.ProvidedTrack
func (*List) SetPlayingQueue ¶
func (*List) SetQueue ¶
func (tl *List) SetQueue(_ []*connectpb.ContextTrack, next []*connectpb.ContextTrack)
func (*List) Snapshot ¶ added in v0.10.0
Snapshot builds the view of this list the daemon publishes. nextHint, when non-nil, supplies the upcoming order from a set_queue command; otherwise the upcoming tracks are walked out of the context, which may fetch pages.
func (*List) TrySeekTo ¶ added in v0.9.0
TrySeekTo positions the list at track, whether it is queued or part of the context. When the bounded seek cannot find it in the context the track is played anyway, ahead of the context, and playback carries on into the context from its start afterwards.
func (*List) UpcomingQueue ¶ added in v0.10.2
func (tl *List) UpcomingQueue() []*connectpb.ContextTrack
UpcomingQueue returns the queued tracks still to play: the whole queue, less the entry playing right now.
type Snapshot ¶ added in v0.10.0
type Snapshot struct {
Metadata map[string]string
Current *connectpb.ProvidedTrack
Prev []*connectpb.ProvidedTrack
Next []*connectpb.ProvidedTrack
Index *connectpb.ContextIndex
}
Snapshot is a plain-data view of a List: everything the daemon publishes about it, owning all of its own memory. Building one is how the list stays behind a single accessor while what it describes is read from elsewhere.