Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("platform: unsupported operation")
ErrUnsupported is returned when a provider cannot represent a requested operation. It lets the UI hide an unsupported capability instead of guessing from a platform ID.
Functions ¶
This section is empty.
Types ¶
type AlbumLiker ¶
AlbumLiker is an optional capability for platforms with starred/collected albums.
type Connector ¶
Connector is implemented by providers that have a sign-in or connection lifecycle, such as a local music server.
type HTTPHeaders ¶
HTTPHeaders is an optional capability for a stream that needs signed request headers. It is kept separate from Provider so ordinary providers remain simple.
type ListKind ¶
type ListKind string
ListKind describes a list a provider can page through. The values are deliberately service-neutral; a provider maps them to its own endpoints.
type Lyrics ¶
Lyrics is the common lyric payload. Translation and word-timed lyrics are optional because not every service supplies them.
type Page ¶
Page is the common result for song and card lists. A provider fills only the fields relevant to the requested kind and always reports Total when the service provides it.
type PageRequest ¶
PageRequest selects one page of a provider list. Page is zero based at the seam; adapters convert it when their service uses one based pages.
type PlaylistEditor ¶
type PlaylistEditor interface {
CreatePlaylist(context.Context, string) (pluginapi.Playlist, error)
RenamePlaylist(context.Context, pluginapi.Playlist, string) error
DeletePlaylist(context.Context, pluginapi.Playlist) error
AddToPlaylist(context.Context, pluginapi.Playlist, []pluginapi.Track) error
RemoveFromPlaylist(context.Context, pluginapi.Playlist, []pluginapi.Track) error
}
PlaylistEditor is an optional capability for platforms whose playlists can be changed by the user.
type Provider ¶
type Provider interface {
ID() pluginapi.ID
Name() string
Page(context.Context, PageRequest) (Page, error)
Search(context.Context, string, SearchKind, int, int) (Page, error)
Stream(context.Context, *pluginapi.Track) (*pluginapi.Stream, error)
Lyrics(context.Context, *pluginapi.Track) (Lyrics, error)
Cover(context.Context, string, int) ([]byte, error)
}
Provider describes the common operations of a music service client. Connection, playlist editing, likes and transcoding are optional capabilities below, so a caller does not need to type-switch on a platform name to discover what it supports.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores the providers known to an app. It owns no provider lifecycle; the app switches and closes sessions explicitly.
func NewRegistry ¶
NewRegistry builds a registry and rejects duplicate or nil providers.
type SearchKind ¶
type SearchKind ListKind
SearchKind selects the result type returned by Search.
const ( SearchSongs SearchKind = "songs" SearchAlbums SearchKind = "albums" SearchArtists SearchKind = "artists" )
type Transcoder ¶
type Transcoder interface {
ShouldTranscode(*pluginapi.Track) bool
TranscodedStream(context.Context, *pluginapi.Track, int) (*pluginapi.Stream, error)
}
Transcoder is an optional capability. The returned stream uses the shared player stream model; the concrete HLS/session implementation stays inside the provider adapter.