Documentation
¶
Index ¶
- Constants
- type Album
- type Artist
- type Client
- func (c *Client) AddSongsToPlaylist(playlistID string, trackIDs []string) error
- func (c *Client) BaseURL() *url.URL
- func (c *Client) CreatePlaylist(name string, trackIDs []string) error
- func (c *Client) DeletePlaylist(playlistID string) error
- func (c *Client) GetAlbum(albumID string) (*Album, error)
- func (c *Client) GetAlbumArtists(opts QueryOpts) ([]*Artist, error)
- func (c *Client) GetAlbums(opts QueryOpts) ([]*Album, error)
- func (c *Client) GetArtist(artistID string) (*Artist, error)
- func (c *Client) GetGenres(paging Paging) ([]NameID, error)
- func (c *Client) GetInstantMix(id string, idType ItemType, limit int) ([]*Song, error)
- func (c *Client) GetItemImage(itemID, imageTag string, size, quality int) (image.Image, error)
- func (c *Client) GetItemImageBinary(itemID, imageTag string, size, quality int) (io.ReadCloser, error)
- func (c *Client) GetLyrics(itemID string) (*Lyrics, error)
- func (c *Client) GetPlaylist(playlistID string) (*Playlist, error)
- func (c *Client) GetPlaylistSongs(playlistID string) ([]*Song, error)
- func (c *Client) GetPlaylists() ([]*Playlist, error)
- func (c *Client) GetSimilarArtists(artistID string) ([]*Artist, error)
- func (c *Client) GetSong(songID string) (*Song, error)
- func (c *Client) GetSongs(opts QueryOpts) ([]*Song, error)
- func (c *Client) GetStreamURL(id string) (string, error)
- func (c *Client) LoggedInUser() string
- func (c *Client) Login(username, password string) error
- func (c *Client) MovePlaylistSong(playlistID string, trackID string, newIdx int) error
- func (c *Client) Ping() (*PingResponse, error)
- func (c *Client) RefreshLibrary() error
- func (c *Client) RemoveSongsFromPlaylist(playlistID string, removeIndexes []int) error
- func (jf *Client) Search(query string, itemType ItemType, paging Paging) (*SearchResult, error)
- func (c *Client) SetFavorite(id string, favorite bool) error
- func (c *Client) UpdatePlayStatus(songID string, event PlayEvent, positionTicks int64) error
- func (c *Client) UpdatePlaylistMetadata(playlistID, name, overview string) error
- type ClientOptionFunc
- type Filter
- type FilterPlayStatus
- type Images
- type ItemType
- type LyricLine
- type LyricMetadata
- type Lyrics
- type MediaSource
- type NameID
- type Paging
- type PingResponse
- type PlayEvent
- type Playlist
- type QueryOpts
- type SearchResult
- type Song
- type Sort
- type SortField
- type SortOrder
- type UserData
Constants ¶
const ( FilterIsPlayed = "Played" FilterIsNotPlayed = "Not played" )
const (
DefaultTimeOut = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { Name string `json:"Name"` ID string `json:"Id"` RunTimeTicks int64 `json:"RunTimeTicks"` Year int `json:"ProductionYear"` DateCreated string `json:"DateCreated"` Type string `json:"Type"` Artists []NameID `json:"AlbumArtists"` Overview string `json:"Overview"` Genres []string `json:"Genres"` ChildCount int `json:"ChildCount"` ImageTags Images `json:"ImageTags"` UserData UserData `json:"UserData"` }
type Client ¶
type Client struct { HTTPClient *http.Client ClientName string ClientVersion string // contains filtered or unexported fields }
Client is the root struct for all Jellyfin API calls
func NewClient ¶
func NewClient(urlStr, clientName, clientVersion string, opts ...ClientOptionFunc) (*Client, error)
NewClient creates a jellyfin Client using the url provided.
func (*Client) AddSongsToPlaylist ¶
func (*Client) CreatePlaylist ¶
func (*Client) DeletePlaylist ¶
func (*Client) GetAlbumArtists ¶
func (*Client) GetAlbums ¶
GetAlbums returns albums with given sort, filter, and paging options. - Can be used to get an artist's discography with ArtistID filter.
func (*Client) GetInstantMix ¶
func (*Client) GetItemImage ¶
func (*Client) GetItemImageBinary ¶
func (*Client) GetPlaylistSongs ¶
func (*Client) GetPlaylists ¶
GetPlaylists retrieves all playlists. Each playlists song count is known, but songs must be retrieved separately
func (*Client) GetSimilarArtists ¶
func (*Client) GetSongs ¶
Get songs matching the given filter criteria with given sorting and paging.
- Can be used to get an album track list with the ParentID filter.
- Can be used to get top songs for an artist with the ArtistId filter and sorting by CommunityRating descending
func (*Client) LoggedInUser ¶
LoggedInUser returns the user associated with this Client.
func (*Client) Login ¶
Login authenticates a user into the server provided in Client. If the login is successful, the access token is stored for future API calls.
func (*Client) MovePlaylistSong ¶
func (*Client) Ping ¶
func (c *Client) Ping() (*PingResponse, error)
Ping queries the jellyfin server for a response. Return is some basic information about the jellyfin server.
func (*Client) RefreshLibrary ¶
func (*Client) RemoveSongsFromPlaylist ¶
func (*Client) UpdatePlayStatus ¶
func (*Client) UpdatePlaylistMetadata ¶
type ClientOptionFunc ¶
type ClientOptionFunc func(*Client)
ClientOptionFunc can be used to customize a new jellyfin API client.
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOptionFunc
Http client override.
type Filter ¶
type Filter struct { // Played FilterPlayed FilterPlayStatus // Favorite marks items as being starred / favorite. Favorite bool // Include only results from the given artist. ArtistID string // Include only results with the given parentID. ParentID string // Genres contains list of genres to include. Genres []string // YearRange contains two elements, items must be within these boundaries. YearRange [2]int }
Filter contains filter for reducing results. Some fields are exclusive,
type FilterPlayStatus ¶
type FilterPlayStatus string
type LyricMetadata ¶
type LyricMetadata struct { Artist string `json:"Artist"` Album string `json:"Album"` Title string `json:"Title"` Author string `json:"Author"` Length int64 `json:"Length"` By string `json:"By"` Offset int64 `json:"Offset"` Creator string `json:"Creator"` Version string `json:"Version"` IsSynced bool `json:"IsSynced"` }
type Lyrics ¶
type Lyrics struct { Metadata LyricMetadata `json:"Metadata"` Lyrics []LyricLine `json:"Lyrics"` }
type MediaSource ¶
type PingResponse ¶
type Playlist ¶
type Playlist struct { Name string `json:"Name"` ID string `json:"Id"` Overview string `json:"Overview"` DateCreated string `json:"DateCreated"` PremiereDate string `json:"PremiereDate"` DateLastMediaAdded string `json:"DateLastMediaAdded"` Genres []string `json:"Genres"` RunTimeTicks int64 `json:"RunTimeTicks"` Type string `json:"Type"` MediaType string `json:"MediaType"` ImageTags Images `json:"ImageTags"` Tags []string `json:"Tags"` ProviderIds map[string]string `json:"ProviderIds"` SongCount int `json:"ChildCount"` }
type SearchResult ¶
type Song ¶
type Song struct { Name string `json:"Name"` Id string `json:"Id"` PlaylistItemId string `json:"PlaylistItemId"` RunTimeTicks int64 `json:"RunTimeTicks"` ProductionYear int `json:"ProductionYear"` DateCreated string `json:"DateCreated"` IndexNumber int `json:"IndexNumber"` Type string `json:"Type"` AlbumID string `json:"AlbumId"` Album string `json:"Album"` DiscNumber int `json:"ParentIndexNumber"` Artists []NameID `json:"ArtistItems"` ImageTags Images `json:"ImageTags"` MediaSources []MediaSource `json:"MediaSources"` UserData UserData `json:"UserData"` }
type SortField ¶
type SortField string
const ( SortByName SortField = "SortName" SortByYear SortField = "ProductionYear,PremiereDate" SortByArtist SortField = "AlbumArtist" SortByPlayCount SortField = "PlayCount" SortByRandom SortField = "Random" SortByDateCreated SortField = "DateCreated" SortByDatePlayed SortField = "DatePlayed" SortByCommunityRating SortField = "CommunityRating" )