jellyfin

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package jellyfin implements connection to Jellyfin server. It supports websocket for receiving commands from server and updating status via http post.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache() (*Cache, error)

NewCache creates new cache that's ready to use.

func (*Cache) Count

func (c *Cache) Count() int

Count returns total count of stored items

func (*Cache) Delete

func (c *Cache) Delete(id models.Id)

Delete deletes item with given id. If item is not found, do nothing.

func (*Cache) Get

func (c *Cache) Get(id models.Id) (models.Item, bool)

Get gets single item fro cache. Returns item and flag whether item is found

func (*Cache) GetAlbum

func (c *Cache) GetAlbum(id models.Id) *models.Album

func (*Cache) GetArtist

func (c *Cache) GetArtist(id models.Id) *models.Artist

func (*Cache) GetBatch

func (c *Cache) GetBatch(ids []models.Id) ([]models.Item, bool)

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

func (c *Cache) GetList(id string) ([]models.Id, bool)

GetList gets list of Ids with given id

func (*Cache) GetPlaylist

func (c *Cache) GetPlaylist(id models.Id) *models.Playlist

func (*Cache) GetSong

func (c *Cache) GetSong(id models.Id) *models.Song

func (*Cache) Put

func (c *Cache) Put(id models.Id, item models.Item, expire bool)

Put puts single item. If expire is true, item expires after default expiration

func (*Cache) PutBatch

func (c *Cache) PutBatch(items []models.Item, expire bool) error

PutBatch put's multiple items with expiration. Each item must have a valid id or operation fails returning error.

func (*Cache) PutList

func (c *Cache) PutList(id string, data []models.Id)

PutList puts a list of ids under key

type Jellyfin

type Jellyfin struct {
	task.Task

	DeviceId  string
	SessionId string
	// contains filtered or unexported fields
}

func NewJellyfin

func NewJellyfin(conf *config.Jellyfin, provider config.KeyValueProvider) (*Jellyfin, error)

func (*Jellyfin) AuthOk

func (jf *Jellyfin) AuthOk() error

func (*Jellyfin) CanCacheSongs added in v0.9.0

func (jf *Jellyfin) CanCacheSongs() bool

func (*Jellyfin) Connect

func (jf *Jellyfin) Connect() error

Connect opens a connection to server. If websockets are supported, use that. Report capabilities to server. This should be called before streaming any media

func (*Jellyfin) ConnectionOk

func (jf *Jellyfin) ConnectionOk() error

func (*Jellyfin) DefaultMusicView

func (jf *Jellyfin) DefaultMusicView() string

func (*Jellyfin) Download

func (jf *Jellyfin) Download(song *models.Song) (io.ReadCloser, interfaces.AudioFormat, error)

func (*Jellyfin) GetAlbum

func (jf *Jellyfin) GetAlbum(id models.Id) (*models.Album, error)

func (*Jellyfin) GetAlbumArtist

func (jf *Jellyfin) GetAlbumArtist(album *models.Album) (*models.Artist, error)

func (*Jellyfin) GetAlbumArtists

func (jf *Jellyfin) GetAlbumArtists(query *interfaces.QueryOpts) (artistList []*models.Artist, numRecords int, err error)

func (*Jellyfin) GetAlbumSongs

func (jf *Jellyfin) GetAlbumSongs(album models.Id) ([]*models.Song, error)

GetAlbumSongs gets songs for given album.

func (*Jellyfin) GetAlbums

func (jf *Jellyfin) GetAlbums(opts *interfaces.QueryOpts) (albumList []*models.Album, numRecords int, err error)

GetAlbums returns albums with given paging. It also returns number of all albums

func (*Jellyfin) GetArtist

func (jf *Jellyfin) GetArtist(id models.Id) (*models.Artist, error)

func (*Jellyfin) GetArtistAlbums

func (jf *Jellyfin) GetArtistAlbums(id models.Id) ([]*models.Album, error)

GetArtistAlbums retrieves albums for given artist.

func (*Jellyfin) GetArtists

func (jf *Jellyfin) GetArtists(query *interfaces.QueryOpts) (artistList []*models.Artist, numRecords int, err error)

getArtists return artists defined by paging and total number of artists

func (*Jellyfin) GetCacheItems

func (jf *Jellyfin) GetCacheItems() int

func (*Jellyfin) GetChildItems

func (jf *Jellyfin) GetChildItems(id models.Id) ([]models.Item, error)

func (*Jellyfin) GetConfig

func (jf *Jellyfin) GetConfig() config.Backend

func (*Jellyfin) GetFavoriteAlbums

func (jf *Jellyfin) GetFavoriteAlbums(paging interfaces.Paging) ([]*models.Album, int, error)

func (*Jellyfin) GetFavoriteArtists

func (jf *Jellyfin) GetFavoriteArtists() ([]*models.Artist, error)

func (*Jellyfin) GetGenreAlbums

func (jf *Jellyfin) GetGenreAlbums(genre models.IdName) ([]*models.Album, error)

func (*Jellyfin) GetGenres

func (jf *Jellyfin) GetGenres(paging interfaces.Paging) ([]*models.IdName, int, error)

func (*Jellyfin) GetId added in v0.9.0

func (jf *Jellyfin) GetId() string

func (*Jellyfin) GetImageUrl added in v0.9.0

func (jf *Jellyfin) GetImageUrl(item models.Id, itemType models.ItemType) string

ImageUrl returns primary image url for item, if there is one. Otherwise return empty

func (*Jellyfin) GetInfo

func (jf *Jellyfin) GetInfo() (*models.ServerInfo, error)

func (*Jellyfin) GetInstantMix

func (jf *Jellyfin) GetInstantMix(item models.Item) ([]*models.Song, error)

GetInstantMix returns instant mix for given item.

func (*Jellyfin) GetItem

func (jf *Jellyfin) GetItem(id models.Id) (models.Item, error)

func (*Jellyfin) GetLatestAlbums

func (jf *Jellyfin) GetLatestAlbums() ([]*models.Album, error)
func (jf *Jellyfin) GetLink(item models.Item) string

func (*Jellyfin) GetParentItem

func (jf *Jellyfin) GetParentItem(id models.Id) (models.Item, error)

func (*Jellyfin) GetPlaylistSongs

func (jf *Jellyfin) GetPlaylistSongs(playlist models.Id) ([]*models.Song, error)

GetPlaylistSongs returns songs for playlist id

func (*Jellyfin) GetPlaylists

func (jf *Jellyfin) GetPlaylists() ([]*models.Playlist, error)

GetPlaylists retrieves all playlists. Each playlists song count is known, but songs must be retrieved separately

func (*Jellyfin) GetRecentlyPlayed

func (jf *Jellyfin) GetRecentlyPlayed(paging interfaces.Paging) ([]*models.Song, int, error)

func (*Jellyfin) GetSimilarAlbums

func (jf *Jellyfin) GetSimilarAlbums(album models.Id) ([]*models.Album, error)

func (*Jellyfin) GetSimilarArtists

func (jf *Jellyfin) GetSimilarArtists(artist models.Id) ([]*models.Artist, error)

func (*Jellyfin) GetSongs

func (jf *Jellyfin) GetSongs(query *interfaces.QueryOpts) ([]*models.Song, int, error)

GetSongs returns songs by paging, and returns total number of songs

func (*Jellyfin) GetSongsById

func (jf *Jellyfin) GetSongsById(ids []models.Id) ([]*models.Song, error)

func (*Jellyfin) GetUserViews

func (jf *Jellyfin) GetUserViews()

func (*Jellyfin) GetViews

func (jf *Jellyfin) GetViews() ([]*models.View, error)

func (*Jellyfin) RemoteControlEnabled

func (jf *Jellyfin) RemoteControlEnabled() error

func (*Jellyfin) ReportCapabilities

func (jf *Jellyfin) ReportCapabilities() error

func (*Jellyfin) ReportProgress

func (jf *Jellyfin) ReportProgress(state *interfaces.ApiPlaybackState) error

ReportProgress reports playback status to server

func (*Jellyfin) Search

func (jf *Jellyfin) Search(query string, itemType models.ItemType, limit int) ([]models.Item, error)

Search searches audio items

func (*Jellyfin) ServerId

func (jf *Jellyfin) ServerId() string

func (*Jellyfin) SetDefaultMusicview

func (jf *Jellyfin) SetDefaultMusicview(id string)

func (*Jellyfin) SetPlayer

func (jf *Jellyfin) SetPlayer(p interfaces.Player)

func (*Jellyfin) SetQueue

func (jf *Jellyfin) SetQueue(q interfaces.QueueController)

func (*Jellyfin) SetServerId

func (jf *Jellyfin) SetServerId(id string)

func (*Jellyfin) Start

func (jf *Jellyfin) Start() error

func (*Jellyfin) Stream

func (jf *Jellyfin) Stream(song *models.Song) (rc io.ReadCloser, format interfaces.AudioFormat, err error)

func (*Jellyfin) TokenOk

func (jf *Jellyfin) TokenOk() error

func (*Jellyfin) VerifyServerId

func (jf *Jellyfin) VerifyServerId() error

func (*Jellyfin) WebsocketOk

func (jf *Jellyfin) WebsocketOk() bool

WebsocketOk returns true if websocket connection is ok

type MediaLibrary

type MediaLibrary struct {
	Name     string `json:"Name"`
	ServerId string `json:"ServerId"`
	Id       string `json:"Id"`
}

type MediaViewResponse

type MediaViewResponse struct {
	Libraries []MediaLibrary `json:"Items"`
}

type SearchHint

type SearchHint struct {
	Id          string `json:"Id"`
	Name        string `json:"Name"`
	Year        int    `json:"ProductionYear"`
	Type        string `json:"Type"`
	Duration    int    `json:"RunTimeTicks"`
	Album       string `json:"Album"`
	AlbumId     string `json:"AlbumId"`
	AlbumArtist string `json:"AlbumArtist"`
}

type SearchResult

type SearchResult struct {
	Items []SearchHint `json:"SearchHints"`
}

Jump to

Keyboard shortcuts

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