Documentation ¶
Index ¶
- type Api
- func (a *Api) ConnectionOk() bool
- func (a *Api) DefaultMusicView() string
- func (a *Api) GetAlbum(id models.Id) (models.Album, error)
- func (a *Api) GetAlbumSongs(album models.Id) ([]*models.Song, error)
- func (a *Api) GetArtist(id models.Id) (models.Artist, error)
- func (a *Api) GetArtistAlbums(id models.Id) ([]*models.Album, error)
- func (a *Api) GetChildItems(id models.Id) ([]models.Item, error)
- func (a *Api) GetFavoriteArtists() ([]*models.Artist, error)
- func (a *Api) GetItem(id models.Id) (models.Item, error)
- func (a *Api) GetItems(ids []models.Id) ([]models.Item, error)
- func (a *Api) GetLatestAlbums() ([]*models.Album, error)
- func (a *Api) GetParentItem(id models.Id) (models.Item, error)
- func (a *Api) GetServerVersion() (string, string, string, error)
- func (a *Api) GetSongDirect(id string, codec string) (io.ReadCloser, error)
- func (a *Api) GetUserViews()
- func (a *Api) GetViews() ([]*models.View, error)
- func (a *Api) Host() string
- func (a *Api) IsLoggedIn() bool
- func (a *Api) Login(username, password string) error
- func (a *Api) ReportProgress(state *PlaybackState) error
- func (a *Api) Search(q string, limit int) (*SearchResult, error)
- func (a *Api) ServerId() string
- func (a *Api) SetDefaultMusicview(id string)
- func (a *Api) SetServerId(id string)
- func (a *Api) SetToken(token string) error
- func (a *Api) SetUserId(id string)
- func (a *Api) Token() string
- func (a *Api) UserId() string
- func (a *Api) VerifyServerId() error
- type Cache
- func (c *Cache) Count() int
- func (c *Cache) Delete(id models.Id)
- func (c *Cache) Get(id models.Id) (models.Item, bool)
- func (c *Cache) GetBatch(ids []models.Id) ([]models.Item, bool)
- func (c *Cache) GetList(id string) ([]models.Id, bool)
- func (c *Cache) Put(id models.Id, item models.Item, expire bool)
- func (c *Cache) PutBatch(items []models.Item, expire bool) error
- func (c *Cache) PutList(id string, data []models.Id)
- type MediaLibrary
- type MediaServer
- type MediaViewResponse
- type PlaybackEvent
- type PlaybackState
- type SearchHint
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { task.Task DeviceId string SessionId string // contains filtered or unexported fields }
func (*Api) GetAlbumSongs ¶
GetAlbumSongs gets songs for given album.
func (*Api) GetArtistAlbums ¶
GetArtistAlbums retrieves albums for given artist.
func (*Api) GetServerVersion ¶
GetServerVersion returns name, version, id and possible error
func (*Api) GetSongDirect ¶
func (*Api) Login ¶
Login performs username based login
func (*Api) ReportProgress ¶
func (a *Api) ReportProgress(state *PlaybackState) error
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) Delete ¶
Delete deletes item with given id. If item is not found, do nothing.
func (*Cache) Get ¶
Get gets single item fro cache. Returns item and flag whether item is found
func (*Cache) GetBatch ¶
GetBatch returns batch of items with given ids. Return array is always same length of ids. However, if not all items are found, return flag is set to false.
func (*Cache) GetList ¶
GetList gets list of Ids with given id
func (*Cache) Put ¶
Put puts single item. If expire is true, item expires after default expiration
func (*Cache) PutBatch ¶
PutBatch put's multiple items with expiration. Each item must have a valid id or operation fails returning error.
type MediaLibrary ¶
type MediaServer ¶
type MediaServer interface { //GetSongDirect downloads song and returns readcloser if any. GetSongDirect(id string, codec string) (io.ReadCloser, error) //Search returns Songs that match query //TODO: set single / multiple of artist, album, playlist, song Search(query string, limit int) (*SearchResult, error) //ReportProgress reports current playing progress to server ReportProgress(state *PlaybackState) error //GetItem retrieves single item by its id GetItem(id models.Id) (models.Item, error) //GetItems retrieves multiple items by their id's GetItems(ids []models.Id) ([]models.Item, error) //GetArtist gets artist by id. GetArtist(id models.Id) (models.Artist, error) //Getalbum retrieves album by id. GetAlbum(id models.Id) (models.Album, error) }
MediaServer uses Jellyfin servers resources and exposes them
type MediaViewResponse ¶
type MediaViewResponse struct {
Libraries []MediaLibrary `json:"Items"`
}
type PlaybackEvent ¶
type PlaybackEvent string
const ( // Internal events EventStart PlaybackEvent = "start" EventStop PlaybackEvent = "stop" // Outgoing events EventTimeUpdate PlaybackEvent = "TimeUpdate" EventPause PlaybackEvent = "Pause" EventUnpause PlaybackEvent = "Unnpause" EventVolumeChange PlaybackEvent = "VolumeChange" EventRepeatModeChange PlaybackEvent = "RepeatModeChange" EventAudioTrackChange PlaybackEvent = "AudioTrackChange" EventSubtitleTrackChange PlaybackEvent = "SubtitleTrackChange" EventPlaylistItemMove PlaybackEvent = "PlaylistItemMove" EventPlaylistItemRemove PlaybackEvent = "PlaylistItemRemove" EventPlaylistItemAdd PlaybackEvent = "PlaylistItemAdd" EventQualityChange PlaybackEvent = "QualityChange" )
type PlaybackState ¶
type PlaybackState struct { Event PlaybackEvent ItemId string IsPaused bool IsMuted bool // Total length of current playlist in seconds PlaylistLength int // Position in seconds Position int // Volume in 0-100 Volume int }
Playbackstate reports playback back to server
type SearchHint ¶
type SearchResult ¶
type SearchResult struct {
Items []SearchHint `json:"SearchHints"`
}