Documentation
¶
Overview ¶
Package embyapi implements the shared Emby/Jellyfin HTTP client. The two servers speak nearly the same API; the few differences (auth header scheme, ping endpoint, user-id discovery, error prefix, metadata key) are isolated in a dialect so emby and jellyfin can be thin wrappers over one client.
Index ¶
- Constants
- func IsStreamURL(path string) bool
- type Album
- type Client
- func (c *Client) AlbumList(sortType string, offset, size int) ([]provider.AlbumInfo, error)
- func (c *Client) AlbumSortTypes() []provider.SortType
- func (c *Client) Albums() ([]Album, error)
- func (c *Client) AlbumsByLibrary(libraryID string) ([]Album, error)
- func (c *Client) ArtistAlbums(artistID string) ([]provider.AlbumInfo, error)
- func (c *Client) Artists() ([]provider.ArtistInfo, error)
- func (c *Client) ClearCache()
- func (c *Client) DefaultAlbumSort() string
- func (c *Client) MetaKey() string
- func (c *Client) MusicLibraries() ([]Library, error)
- func (c *Client) Ping() error
- func (c *Client) ReportNowPlaying(track playlist.Track, position time.Duration, canSeek bool) error
- func (c *Client) ReportScrobble(track playlist.Track, elapsed time.Duration, canSeek bool) error
- func (c *Client) Search(query string, limit int) ([]Track, error)
- func (c *Client) SetHTTPClient(hc *http.Client)
- func (c *Client) StreamURL(itemID string) string
- func (c *Client) Tracks(albumID string) ([]Track, error)
- func (c *Client) UserID() (string, error)
- type Library
- type Track
Constants ¶
const ( SortAlbumsByName = "name" SortAlbumsByArtist = "artist" SortAlbumsByYear = "year" )
Variables ¶
This section is empty.
Functions ¶
func IsStreamURL ¶
IsStreamURL reports whether the given URL looks like an item download endpoint. Used by the player to route these URLs through the buffered ffmpeg pipeline instead of native HTTP streaming.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client speaks to an Emby or Jellyfin server over its HTTP API.
func NewEmbyClient ¶
NewEmbyClient returns a Client configured for an Emby server.
func NewJellyfinClient ¶
NewJellyfinClient returns a Client configured for a Jellyfin server.
func (*Client) AlbumList ¶
AlbumList returns one page from the full album catalog, sorted client-side.
func (*Client) AlbumSortTypes ¶
func (*Client) Albums ¶
Albums returns all albums across every music library. Results are cached after the first successful call.
func (*Client) AlbumsByLibrary ¶
AlbumsByLibrary returns all albums under one music library view.
func (*Client) ArtistAlbums ¶
ArtistAlbums returns all albums for one artist, derived from the full album list.
func (*Client) Artists ¶
func (c *Client) Artists() ([]provider.ArtistInfo, error)
Artists returns a derived artist list built from the server's album catalog.
func (*Client) ClearCache ¶
func (c *Client) ClearCache()
ClearCache discards the cached album list so the next Albums call re-fetches.
func (*Client) DefaultAlbumSort ¶
func (*Client) MetaKey ¶
MetaKey returns the playlist.Track ProviderMeta key for this server's item IDs.
func (*Client) MusicLibraries ¶
MusicLibraries returns all user views whose collection type is music.
func (*Client) ReportNowPlaying ¶
func (*Client) ReportScrobble ¶
func (*Client) Search ¶
Search searches the user's audio library for tracks matching query and returns up to limit results.
func (*Client) SetHTTPClient ¶
SetHTTPClient overrides the HTTP client used for requests. Mainly for tests that inject a custom transport.