Documentation
¶
Index ¶
- Constants
- func NewKodiAlbumLauncher() platforms.Launcher
- func NewKodiArtistLauncher() platforms.Launcher
- func NewKodiLocalLauncher() platforms.Launcher
- func NewKodiMovieLauncher() platforms.Launcher
- func NewKodiMusicLauncher() platforms.Launcher
- func NewKodiSongLauncher() platforms.Launcher
- func NewKodiTVLauncher() platforms.Launcher
- func NewKodiTVShowLauncher() platforms.Launcher
- func ScanAlbums(client KodiClient, _ *config.Instance, _ string, ...) ([]platforms.ScanResult, error)
- func ScanArtists(client KodiClient, _ *config.Instance, _ string, ...) ([]platforms.ScanResult, error)
- func ScanMovies(client KodiClient, _ *config.Instance, _ string, ...) ([]platforms.ScanResult, error)
- func ScanSongs(client KodiClient, _ *config.Instance, _ string, ...) ([]platforms.ScanResult, error)
- func ScanTV(client KodiClient, _ *config.Instance, _ string, ...) ([]platforms.ScanResult, error)
- func ScanTVShows(client KodiClient, _ *config.Instance, _ string, ...) ([]platforms.ScanResult, error)
- type APIError
- type APIMethod
- type APIPayload
- type APIResponse
- type Album
- type Artist
- type AudioLibraryGetAlbumsResponse
- type AudioLibraryGetArtistsResponse
- type AudioLibraryGetSongsParams
- type AudioLibraryGetSongsResponse
- type Client
- func (c *Client) APIRequest(method APIMethod, params any) (json.RawMessage, error)
- func (c *Client) GetActivePlayers() ([]Player, error)
- func (c *Client) GetAlbums() ([]Album, error)
- func (c *Client) GetArtists() ([]Artist, error)
- func (c *Client) GetEpisodes(tvShowID int) ([]Episode, error)
- func (c *Client) GetMovies() ([]Movie, error)
- func (c *Client) GetSongs() ([]Song, error)
- func (c *Client) GetTVShows() ([]TVShow, error)
- func (c *Client) GetURL() string
- func (c *Client) LaunchAlbum(path string) error
- func (c *Client) LaunchArtist(path string) error
- func (c *Client) LaunchFile(path string) error
- func (c *Client) LaunchMovie(path string) error
- func (c *Client) LaunchSong(path string) error
- func (c *Client) LaunchTVEpisode(path string) error
- func (c *Client) LaunchTVShow(path string) error
- func (c *Client) SetURL(url string)
- func (c *Client) Stop() error
- type Episode
- type FilterRule
- type Item
- type ItemOptions
- type KodiClient
- type Movie
- type Player
- type PlayerOpenParams
- type PlayerStopParams
- type PlaylistAddEpisodesParams
- type PlaylistAddParams
- type PlaylistClearParams
- type PlaylistItemEpisodeID
- type PlaylistItemSongID
- type Song
- type TVShow
- type VideoLibraryGetEpisodesParams
- type VideoLibraryGetEpisodesResponse
- type VideoLibraryGetMoviesResponse
- type VideoLibraryGetTVShowsResponse
Constants ¶
const ( SchemeKodiMovie = "kodi-movie" SchemeKodiEpisode = "kodi-episode" SchemeKodiSong = "kodi-song" SchemeKodiAlbum = "kodi-album" SchemeKodiArtist = "kodi-artist" SchemeKodiShow = "kodi-show" )
URL scheme constants for Kodi media
Variables ¶
This section is empty.
Functions ¶
func NewKodiAlbumLauncher ¶
NewKodiAlbumLauncher creates a KodiAlbum launcher for album collection playback
func NewKodiArtistLauncher ¶
NewKodiArtistLauncher creates a KodiArtist launcher for artist collection playback
func NewKodiLocalLauncher ¶
NewKodiLocalLauncher creates a standard KodiLocal launcher for direct video file playback
func NewKodiMovieLauncher ¶
NewKodiMovieLauncher creates a standard KodiMovie launcher for library movie playback
func NewKodiMusicLauncher ¶
NewKodiMusicLauncher creates a KodiMusic launcher for local music files
func NewKodiSongLauncher ¶
NewKodiSongLauncher creates a KodiSong launcher for individual song playback
func NewKodiTVLauncher ¶
NewKodiTVLauncher creates a standard KodiTV launcher for library TV episode playback
func NewKodiTVShowLauncher ¶
NewKodiTVShowLauncher creates a KodiTVShow launcher for TV show collection playback
func ScanAlbums ¶
func ScanAlbums( client KodiClient, _ *config.Instance, _ string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error)
ScanAlbums scans albums from Kodi library using the provided client
func ScanArtists ¶
func ScanArtists( client KodiClient, _ *config.Instance, _ string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error)
ScanArtists scans artists from Kodi library using the provided client
func ScanMovies ¶
func ScanMovies( client KodiClient, _ *config.Instance, _ string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error)
ScanMovies scans movies from Kodi library using the provided client
func ScanSongs ¶
func ScanSongs( client KodiClient, _ *config.Instance, _ string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error)
ScanSongs scans songs from Kodi library using the provided client
func ScanTV ¶
func ScanTV( client KodiClient, _ *config.Instance, _ string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error)
ScanTV scans TV shows and episodes from Kodi library using the provided client
func ScanTVShows ¶
func ScanTVShows( client KodiClient, _ *config.Instance, _ string, results []platforms.ScanResult, ) ([]platforms.ScanResult, error)
ScanTVShows scans TV shows from Kodi library using the provided client
Types ¶
type APIMethod ¶
type APIMethod string
APIMethod represents Kodi JSON-RPC API methods
const ( APIMethodPlayerOpen APIMethod = "Player.Open" APIMethodPlayerGetActivePlayers APIMethod = "Player.GetActivePlayers" APIMethodPlayerStop APIMethod = "Player.Stop" APIMethodVideoLibraryGetMovies APIMethod = "VideoLibrary.GetMovies" APIMethodVideoLibraryGetTVShows APIMethod = "VideoLibrary.GetTVShows" APIMethodVideoLibraryGetEpisodes APIMethod = "VideoLibrary.GetEpisodes" // Audio Library APIMethodAudioLibraryGetSongs APIMethod = "AudioLibrary.GetSongs" APIMethodAudioLibraryGetAlbums APIMethod = "AudioLibrary.GetAlbums" APIMethodAudioLibraryGetArtists APIMethod = "AudioLibrary.GetArtists" // Playlist Management (for collections) APIMethodPlaylistClear APIMethod = "Playlist.Clear" APIMethodPlaylistAdd APIMethod = "Playlist.Add" )
Kodi API methods
type APIPayload ¶
type APIPayload struct {
Params any `json:"params,omitempty"`
JSONRPC string `json:"jsonrpc"`
ID string `json:"id"`
Method APIMethod `json:"method"`
}
APIPayload represents a Kodi JSON-RPC request
type APIResponse ¶
type APIResponse struct {
Error *APIError `json:"error,omitempty"`
ID string `json:"id"`
JSONRPC string `json:"jsonrpc"`
Result json.RawMessage `json:"result"`
}
APIResponse represents a Kodi JSON-RPC response
type Album ¶
type Album struct {
Label string `json:"label"`
Artist string `json:"artist"`
ID int `json:"albumid"`
Year int `json:"year"`
}
Album represents an album in Kodi's library
type AudioLibraryGetAlbumsResponse ¶
type AudioLibraryGetAlbumsResponse struct {
Albums []Album `json:"albums"`
}
AudioLibraryGetAlbumsResponse represents the response from AudioLibrary.GetAlbums
type AudioLibraryGetArtistsResponse ¶
type AudioLibraryGetArtistsResponse struct {
Artists []Artist `json:"artists"`
}
AudioLibraryGetArtistsResponse represents the response from AudioLibrary.GetArtists
type AudioLibraryGetSongsParams ¶
type AudioLibraryGetSongsParams struct {
Filter *FilterRule `json:"filter,omitempty"`
}
AudioLibraryGetSongsParams represents parameters for AudioLibrary.GetSongs API method
type AudioLibraryGetSongsResponse ¶
type AudioLibraryGetSongsResponse struct {
Songs []Song `json:"songs"`
}
AudioLibraryGetSongsResponse represents the response from AudioLibrary.GetSongs
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the KodiClient interface
func (*Client) APIRequest ¶
APIRequest makes a raw JSON-RPC request to Kodi API
func (*Client) GetActivePlayers ¶
GetActivePlayers retrieves all active players in Kodi
func (*Client) GetArtists ¶
GetArtists retrieves all artists from Kodi's library
func (*Client) GetEpisodes ¶
GetEpisodes retrieves all episodes for a specific TV show from Kodi's library
func (*Client) GetTVShows ¶
GetTVShows retrieves all TV shows from Kodi's library
func (*Client) LaunchAlbum ¶
LaunchAlbum launches an album by ID using playlist generation
func (*Client) LaunchArtist ¶
LaunchArtist launches an artist by ID using playlist generation
func (*Client) LaunchFile ¶
LaunchFile launches a local file or URL in Kodi
func (*Client) LaunchMovie ¶
LaunchMovie launches a movie by ID from Kodi's library
func (*Client) LaunchSong ¶
LaunchSong launches a song by ID from Kodi's library
func (*Client) LaunchTVEpisode ¶
LaunchTVEpisode launches a TV episode by ID from Kodi's library
func (*Client) LaunchTVShow ¶
LaunchTVShow launches a TV show by ID using playlist generation
type Episode ¶
type Episode struct {
Label string `json:"label"`
File string `json:"file,omitempty"`
ID int `json:"episodeid"`
TVShowID int `json:"tvshowid"`
Season int `json:"season"`
Episode int `json:"episode"`
}
Episode represents a TV episode in Kodi's library
type FilterRule ¶
type FilterRule struct {
Value any `json:"value"`
Field string `json:"field"`
Operator string `json:"operator"`
}
FilterRule represents a Kodi API filter rule
type Item ¶
type Item struct {
Label string `json:"label,omitempty"`
File string `json:"file,omitempty"`
MovieID int `json:"movieid,omitempty"`
TVShowID int `json:"tvshowid,omitempty"`
EpisodeID int `json:"episodeid,omitempty"`
SongID int `json:"songid,omitempty"`
PlaylistID int `json:"playlistid,omitempty"`
}
Item represents a media item that can be played
type ItemOptions ¶
type ItemOptions struct {
Resume bool `json:"resume"`
}
ItemOptions represents options for playing a media item
type KodiClient ¶
type KodiClient interface {
// LaunchFile launches a local file or URL in Kodi
LaunchFile(path string) error
// LaunchMovie launches a movie by ID from Kodi's library
// Path format: "kodi-movie://[id]/[name]"
LaunchMovie(path string) error
// LaunchTVEpisode launches a TV episode by ID from Kodi's library
// Path format: "kodi-episode://[id]/[name]"
LaunchTVEpisode(path string) error
// Stop stops all active players in Kodi
Stop() error
// GetActivePlayers retrieves all active players in Kodi
GetActivePlayers() ([]Player, error)
// GetMovies retrieves all movies from Kodi's library
GetMovies() ([]Movie, error)
// GetTVShows retrieves all TV shows from Kodi's library
GetTVShows() ([]TVShow, error)
// GetEpisodes retrieves all episodes for a specific TV show from Kodi's library
GetEpisodes(tvShowID int) ([]Episode, error)
// GetSongs retrieves all songs from Kodi's library
GetSongs() ([]Song, error)
// GetAlbums retrieves all albums from Kodi's library
GetAlbums() ([]Album, error)
// GetArtists retrieves all artists from Kodi's library
GetArtists() ([]Artist, error)
// LaunchSong launches a song by ID from Kodi's library
// Path format: "kodi-song://[id]/[name]"
LaunchSong(path string) error
// LaunchAlbum launches an album by ID using playlist generation
// Path format: "kodi-album://[id]/[name]"
LaunchAlbum(path string) error
// LaunchArtist launches an artist by ID using playlist generation
// Path format: "kodi-artist://[id]/[name]"
LaunchArtist(path string) error
// LaunchTVShow launches a TV show by ID using playlist generation
// Path format: "kodi-show://[id]/[name]"
LaunchTVShow(path string) error
// GetURL returns the current Kodi API URL
GetURL() string
// SetURL sets the Kodi API URL
SetURL(url string)
// APIRequest makes a raw JSON-RPC request to Kodi API
APIRequest(method APIMethod, params any) (json.RawMessage, error)
}
KodiClient defines the interface for Kodi API operations. This interface enables proper mocking and TDD for Kodi integration.
func NewClient ¶
func NewClient(cfg *config.Instance) KodiClient
NewClient creates a new Kodi client with configuration-based URL
func NewClientWithLauncherID ¶
func NewClientWithLauncherID(cfg *config.Instance, launcherID string) KodiClient
NewClientWithLauncherID creates a new Kodi client with hierarchical configuration lookup
type Movie ¶
type Movie struct {
Label string `json:"label"`
File string `json:"file,omitempty"`
ID int `json:"movieid"`
}
Movie represents a movie in Kodi's library
type PlayerOpenParams ¶
type PlayerOpenParams struct {
Item Item `json:"item"`
Options ItemOptions `json:"options,omitempty"`
}
PlayerOpenParams represents parameters for Player.Open API method
type PlayerStopParams ¶
type PlayerStopParams struct {
PlayerID int `json:"playerid"`
}
PlayerStopParams represents parameters for Player.Stop API method
type PlaylistAddEpisodesParams ¶
type PlaylistAddEpisodesParams struct {
Item []PlaylistItemEpisodeID `json:"item"`
PlaylistID int `json:"playlistid"`
}
PlaylistAddEpisodesParams represents parameters for Playlist.Add API method with episodes
type PlaylistAddParams ¶
type PlaylistAddParams struct {
Item []PlaylistItemSongID `json:"item"`
PlaylistID int `json:"playlistid"`
}
PlaylistAddParams represents parameters for Playlist.Add API method
type PlaylistClearParams ¶
type PlaylistClearParams struct {
PlaylistID int `json:"playlistid"`
}
PlaylistClearParams represents parameters for Playlist.Clear API method
type PlaylistItemEpisodeID ¶
type PlaylistItemEpisodeID struct {
EpisodeID int `json:"episodeid"`
}
PlaylistItemEpisodeID represents an episode item for playlist operations
type PlaylistItemSongID ¶
type PlaylistItemSongID struct {
SongID int `json:"songid"`
}
PlaylistItemSongID represents a song item for playlist operations
type Song ¶
type Song struct {
Label string `json:"label"`
File string `json:"file,omitempty"`
Artist string `json:"artist"`
ID int `json:"songid"`
AlbumID int `json:"albumid"`
Duration int `json:"duration"`
}
Song represents a song in Kodi's library
type VideoLibraryGetEpisodesParams ¶
type VideoLibraryGetEpisodesParams struct {
TVShowID int `json:"tvshowid"`
}
VideoLibraryGetEpisodesParams represents parameters for VideoLibrary.GetEpisodes API method
type VideoLibraryGetEpisodesResponse ¶
type VideoLibraryGetEpisodesResponse struct {
Episodes []Episode `json:"episodes"`
}
VideoLibraryGetEpisodesResponse represents the response from VideoLibrary.GetEpisodes
type VideoLibraryGetMoviesResponse ¶
type VideoLibraryGetMoviesResponse struct {
Movies []Movie `json:"movies"`
}
VideoLibraryGetMoviesResponse represents the response from VideoLibrary.GetMovies
type VideoLibraryGetTVShowsResponse ¶
type VideoLibraryGetTVShowsResponse struct {
TVShows []TVShow `json:"tvshows"`
}
VideoLibraryGetTVShowsResponse represents the response from VideoLibrary.GetTVShows