Documentation
¶
Overview ¶
Package provider defines optional capability interfaces for music providers. Providers implement the base playlist.Provider interface and may additionally implement any of the interfaces here to expose extended features (browsing, searching, playback reporting, etc.). The UI discovers capabilities at runtime via type assertions.
Index ¶
- Constants
- type AlbumBrowser
- type AlbumInfo
- type AlbumSortSaver
- type AlbumTrackLoader
- type ArtistBrowser
- type ArtistInfo
- type BookmarkSetter
- type CatalogLoader
- type CatalogSearcher
- type Closer
- type CustomStreamer
- type FavoriteToggler
- type PlaybackReporter
- type PlaylistBatchWriter
- type PlaylistCreator
- type PlaylistDeleter
- type PlaylistRenamer
- type PlaylistSaver
- type PlaylistWriter
- type Searcher
- type SectionedList
- type SortType
Constants ¶
const ( MetaJellyfinID = "jellyfin.id" MetaEmbyID = "emby.id" MetaNetEaseID = "netease.id" MetaQobuzID = "qobuz.id" )
ProviderMeta key constants used across providers and the UI.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlbumBrowser ¶
type AlbumBrowser interface {
AlbumList(sortType string, offset, size int) ([]AlbumInfo, error)
AlbumSortTypes() []SortType
DefaultAlbumSort() string
}
AlbumBrowser is implemented by providers that support paginated album listing with configurable sort order.
type AlbumInfo ¶
type AlbumInfo struct {
ID string
Name string
Artist string
ArtistID string
Year int
TrackCount int
Genre string
}
AlbumInfo describes an album in a provider's catalog.
type AlbumSortSaver ¶
AlbumSortSaver is implemented by providers that persist album sort changes.
type AlbumTrackLoader ¶
AlbumTrackLoader is implemented by providers that can return the tracks of a specific album (as opposed to a playlist).
type ArtistBrowser ¶
type ArtistBrowser interface {
Artists() ([]ArtistInfo, error)
ArtistAlbums(artistID string) ([]AlbumInfo, error)
}
ArtistBrowser is implemented by providers that support listing artists and their albums.
type ArtistInfo ¶
ArtistInfo describes an artist in a provider's catalog.
type BookmarkSetter ¶
type BookmarkSetter interface {
SetBookmark(playlistName string, idx int) error
SetBookmarkByPath(playlistName string, path string) error
}
BookmarkSetter is implemented by providers that support toggling track bookmarks and persisting them.
type CatalogLoader ¶
type CatalogLoader interface {
// LoadCatalogPage fetches the next page of catalog entries starting at
// offset. Returns the number of items added and any error.
LoadCatalogPage(offset, limit int) (added int, err error)
}
CatalogLoader is implemented by providers that support lazy-loading catalog pages from an external source (e.g. Radio Browser API).
type CatalogSearcher ¶
type CatalogSearcher interface {
// SearchCatalog performs a server-side search. Results are reflected
// in the next Playlists() call.
SearchCatalog(query string) (int, error)
ClearSearch()
IsSearching() bool
}
CatalogSearcher is implemented by providers that support server-side catalog search (e.g. radio station search via an API).
type Closer ¶
type Closer interface {
Close()
}
Closer is implemented by providers that hold resources (sessions, connections) that should be released on shutdown.
type CustomStreamer ¶
type CustomStreamer interface {
// URISchemes returns the URI prefixes this provider handles.
URISchemes() []string
// NewStreamer creates a decoder for the given URI.
NewStreamer(uri string) (beep.StreamSeekCloser, beep.Format, time.Duration, error)
}
CustomStreamer is implemented by providers that need a custom audio decode path for non-standard URI schemes (e.g. spotify:track:xxx).
type FavoriteToggler ¶
FavoriteToggler is implemented by providers that support marking items as favorites (e.g. radio station favorites).
type PlaybackReporter ¶
type PlaybackReporter interface {
CanReportPlayback(track playlist.Track) bool
ReportNowPlaying(track playlist.Track, position time.Duration, canSeek bool)
ReportScrobble(track playlist.Track, elapsed, duration time.Duration, canSeek bool)
}
PlaybackReporter is implemented by providers that accept now-playing and playback-completion reports for tracks they originated.
type PlaylistBatchWriter ¶
type PlaylistBatchWriter interface {
AddTracksToPlaylist(ctx context.Context, playlistID string, tracks []playlist.Track) (added, skipped int, err error)
}
PlaylistBatchWriter is implemented by providers that support adding multiple tracks to existing playlists in one operation.
type PlaylistCreator ¶
PlaylistCreator is implemented by providers that support creating new playlists.
type PlaylistDeleter ¶
type PlaylistDeleter interface {
DeletePlaylist(name string) error
RemoveTrack(name string, index int) error
}
PlaylistDeleter is implemented by providers that support removing playlists and individual tracks.
type PlaylistRenamer ¶
PlaylistRenamer is implemented by providers that support renaming playlists.
type PlaylistSaver ¶
PlaylistSaver is implemented by providers that can overwrite a playlist's complete ordered track list.
type PlaylistWriter ¶
type PlaylistWriter interface {
AddTrackToPlaylist(ctx context.Context, playlistID string, track playlist.Track) error
}
PlaylistWriter is implemented by providers that support adding tracks to existing playlists.
type Searcher ¶
type Searcher interface {
SearchTracks(ctx context.Context, query string, limit int) ([]playlist.Track, error)
}
Searcher is implemented by providers that support searching for tracks.
type SectionedList ¶
type SectionedList interface {
// IDPrefix returns the section prefix for a playlist ID (e.g. "f", "c", "s").
IDPrefix(id string) string
// IsFavoritableID reports whether the given ID can be favorited.
IsFavoritableID(id string) bool
}
SectionedList is implemented by providers whose playlist list has logical sections (e.g. local stations, favorites, catalog).