provider

package
v1.60.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 4 Imported by: 0

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

View Source
const (
	MetaNavidromeID = "navidrome.id"
	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

type AlbumSortSaver interface {
	SaveAlbumSort(sortType string) error
}

AlbumSortSaver is implemented by providers that persist album sort changes.

type AlbumTrackLoader

type AlbumTrackLoader interface {
	AlbumTracks(albumID string) ([]playlist.Track, error)
}

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

type ArtistInfo struct {
	ID         string
	Name       string
	AlbumCount int
}

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

type FavoriteToggler interface {
	ToggleFavorite(id string) (added bool, name string, err error)
}

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

type PlaylistCreator interface {
	CreatePlaylist(ctx context.Context, name string) (string, error)
}

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

type PlaylistRenamer interface {
	RenamePlaylist(oldName, newName string) error
}

PlaylistRenamer is implemented by providers that support renaming playlists.

type PlaylistSaver

type PlaylistSaver interface {
	SavePlaylist(name string, tracks []playlist.Track) error
}

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).

type SortType

type SortType struct {
	ID    string // e.g. "alphabeticalByName"
	Label string // e.g. "By Name"
}

SortType describes one sort option for album listing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL