kodi

package
v2.7.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: GPL-3.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKodiAlbumLauncher

func NewKodiAlbumLauncher() platforms.Launcher

NewKodiAlbumLauncher creates a KodiAlbum launcher for album collection playback

func NewKodiArtistLauncher

func NewKodiArtistLauncher() platforms.Launcher

NewKodiArtistLauncher creates a KodiArtist launcher for artist collection playback

func NewKodiLocalLauncher

func NewKodiLocalLauncher() platforms.Launcher

NewKodiLocalLauncher creates a standard KodiLocalVideo launcher for direct video file playback

func NewKodiMovieLauncher

func NewKodiMovieLauncher() platforms.Launcher

NewKodiMovieLauncher creates a standard KodiMovie launcher for library movie playback

func NewKodiMusicLauncher

func NewKodiMusicLauncher() platforms.Launcher

NewKodiMusicLauncher creates a KodiLocalAudio launcher for local music files

func NewKodiSongLauncher

func NewKodiSongLauncher() platforms.Launcher

NewKodiSongLauncher creates a KodiSong launcher for individual song playback

func NewKodiTVLauncher

func NewKodiTVLauncher() platforms.Launcher

NewKodiTVLauncher creates a standard KodiTVEpisode launcher for library TV episode playback

func NewKodiTVShowLauncher

func NewKodiTVShowLauncher() platforms.Launcher

NewKodiTVShowLauncher creates a KodiTVShow launcher for TV show collection playback

func ScanAlbums

func ScanAlbums(
	ctx context.Context,
	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(
	ctx context.Context,
	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(
	ctx context.Context,
	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(
	ctx context.Context,
	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(
	ctx context.Context,
	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(
	ctx context.Context,
	client KodiClient,
	_ *config.Instance,
	_ string,
	results []platforms.ScanResult,
) ([]platforms.ScanResult, error)

ScanTVShows scans TV shows from Kodi library using the provided client

Types

type APIError

type APIError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

APIError represents a Kodi JSON-RPC error

type APIMethod

type APIMethod string

APIMethod represents Kodi JSON-RPC API methods

const (
	APIMethodPlayerOpen              APIMethod = "Player.Open"
	APIMethodPlayerGetActivePlayers  APIMethod = "Player.GetActivePlayers"
	APIMethodPlayerGetItem           APIMethod = "Player.GetItem"
	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"

	// Application Control
	APIMethodApplicationQuit APIMethod = "Application.Quit"
)

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:"displayartist"` // Use displayartist (string) instead of artist (array)
	ID     int    `json:"albumid"`
	Year   int    `json:"year"`
}

Album represents an album in Kodi's library

type Artist

type Artist struct {
	Label string `json:"label"`
	ID    int    `json:"artistid"`
}

Artist represents an artist in Kodi's library

type AudioLibraryGetAlbumsParams added in v2.7.0

type AudioLibraryGetAlbumsParams struct {
	Properties []string `json:"properties,omitempty"`
}

AudioLibraryGetAlbumsParams represents parameters for AudioLibrary.GetAlbums API method

type AudioLibraryGetAlbumsResponse

type AudioLibraryGetAlbumsResponse struct {
	Albums []Album `json:"albums"`
}

AudioLibraryGetAlbumsResponse represents the response from AudioLibrary.GetAlbums

type AudioLibraryGetArtistsParams added in v2.7.0

type AudioLibraryGetArtistsParams struct {
	Properties []string `json:"properties,omitempty"`
}

AudioLibraryGetArtistsParams represents parameters for AudioLibrary.GetArtists API method

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"`
	Properties []string    `json:"properties,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

func (c *Client) APIRequest(ctx context.Context, method APIMethod, params any) (json.RawMessage, error)

APIRequest makes a raw JSON-RPC request to Kodi API

func (*Client) GetActivePlayers

func (c *Client) GetActivePlayers(ctx context.Context) ([]Player, error)

GetActivePlayers retrieves all active players in Kodi

func (*Client) GetAlbums

func (c *Client) GetAlbums(ctx context.Context) ([]Album, error)

GetAlbums retrieves all albums from Kodi's library

func (*Client) GetArtists

func (c *Client) GetArtists(ctx context.Context) ([]Artist, error)

GetArtists retrieves all artists from Kodi's library

func (*Client) GetEpisodes

func (c *Client) GetEpisodes(ctx context.Context, tvShowID int) ([]Episode, error)

GetEpisodes retrieves all episodes for a specific TV show from Kodi's library

func (*Client) GetMovies

func (c *Client) GetMovies(ctx context.Context) ([]Movie, error)

GetMovies retrieves all movies from Kodi's library

func (*Client) GetPlayerItem added in v2.7.0

func (c *Client) GetPlayerItem(ctx context.Context, playerID int) (*PlayerItem, error)

GetPlayerItem retrieves the currently playing item for a specific player

func (*Client) GetSongs

func (c *Client) GetSongs(ctx context.Context) ([]Song, error)

GetSongs retrieves all songs from Kodi's library

func (*Client) GetTVShows

func (c *Client) GetTVShows(ctx context.Context) ([]TVShow, error)

GetTVShows retrieves all TV shows from Kodi's library

func (*Client) GetURL

func (c *Client) GetURL() string

GetURL returns the current Kodi API URL

func (*Client) LaunchAlbum

func (c *Client) LaunchAlbum(path string) error

LaunchAlbum launches an album by ID from Kodi's library

func (*Client) LaunchArtist

func (c *Client) LaunchArtist(path string) error

LaunchArtist launches an artist by ID from Kodi's library

func (*Client) LaunchFile

func (c *Client) LaunchFile(path string) error

LaunchFile launches a local file or URL in Kodi

func (*Client) LaunchMovie

func (c *Client) LaunchMovie(path string) error

LaunchMovie launches a movie by ID from Kodi's library

func (*Client) LaunchSong

func (c *Client) LaunchSong(path string) error

LaunchSong launches a song by ID from Kodi's library

func (*Client) LaunchTVEpisode

func (c *Client) LaunchTVEpisode(path string) error

LaunchTVEpisode launches a TV episode by ID from Kodi's library

func (*Client) LaunchTVShow

func (c *Client) LaunchTVShow(path string) error

LaunchTVShow launches a TV show by ID using playlist generation

func (*Client) Quit added in v2.7.0

func (c *Client) Quit(ctx context.Context) error

Quit gracefully exits Kodi application

func (*Client) SetURL

func (c *Client) SetURL(url string)

SetURL sets the Kodi API URL

func (*Client) Stop

func (c *Client) Stop() error

Stop stops all active players in Kodi

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"`
	AlbumID    int    `json:"albumid,omitempty"`
	ArtistID   int    `json:"artistid,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

	// Quit gracefully exits Kodi application
	Quit(ctx context.Context) error

	// GetActivePlayers retrieves all active players in Kodi
	GetActivePlayers(ctx context.Context) ([]Player, error)

	// GetPlayerItem retrieves the currently playing item for a specific player
	GetPlayerItem(ctx context.Context, playerID int) (*PlayerItem, error)

	// GetMovies retrieves all movies from Kodi's library
	GetMovies(ctx context.Context) ([]Movie, error)

	// GetTVShows retrieves all TV shows from Kodi's library
	GetTVShows(ctx context.Context) ([]TVShow, error)

	// GetEpisodes retrieves all episodes for a specific TV show from Kodi's library
	GetEpisodes(ctx context.Context, tvShowID int) ([]Episode, error)

	// GetSongs retrieves all songs from Kodi's library
	GetSongs(ctx context.Context) ([]Song, error)

	// GetAlbums retrieves all albums from Kodi's library
	GetAlbums(ctx context.Context) ([]Album, error)

	// GetArtists retrieves all artists from Kodi's library
	GetArtists(ctx context.Context) ([]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(ctx context.Context, 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 Player

type Player struct {
	Type string `json:"type"`
	ID   int    `json:"playerid"`
}

Player represents an active Kodi player

type PlayerGetItemParams added in v2.7.0

type PlayerGetItemParams struct {
	Properties []string `json:"properties"`
	PlayerID   int      `json:"playerid"`
}

PlayerGetItemParams represents parameters for Player.GetItem API method

type PlayerGetItemResponse added in v2.7.0

type PlayerGetItemResponse struct {
	Item PlayerItem `json:"item"`
}

PlayerGetItemResponse represents the response from Player.GetItem

type PlayerItem added in v2.7.0

type PlayerItem struct {
	Label     string   `json:"label"`
	Type      string   `json:"type"`
	File      string   `json:"file,omitempty"`
	Title     string   `json:"title,omitempty"`
	Album     string   `json:"album,omitempty"`
	ShowTitle string   `json:"showtitle,omitempty"`
	Artist    []string `json:"artist,omitempty"`
	Season    int      `json:"season,omitempty"`
	Episode   int      `json:"episode,omitempty"`
	Year      int      `json:"year,omitempty"`
}

PlayerItem represents the currently playing item

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:"displayartist"` // Use displayartist (string) instead of artist (array)
	Album    string `json:"album"`
	ID       int    `json:"songid"`
	AlbumID  int    `json:"albumid"`
	Duration int    `json:"duration"`
}

Song represents a song in Kodi's library

type TVShow

type TVShow struct {
	Label string `json:"label"`
	ID    int    `json:"tvshowid"`
}

TVShow represents a TV show in Kodi's library

type VideoLibraryGetEpisodesParams

type VideoLibraryGetEpisodesParams struct {
	Properties []string `json:"properties,omitempty"`
	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 VideoLibraryGetMoviesParams added in v2.7.0

type VideoLibraryGetMoviesParams struct {
	Properties []string `json:"properties,omitempty"`
}

VideoLibraryGetMoviesParams represents parameters for VideoLibrary.GetMovies API method

type VideoLibraryGetMoviesResponse

type VideoLibraryGetMoviesResponse struct {
	Movies []Movie `json:"movies"`
}

VideoLibraryGetMoviesResponse represents the response from VideoLibrary.GetMovies

type VideoLibraryGetTVShowsParams added in v2.7.0

type VideoLibraryGetTVShowsParams struct {
	Properties []string `json:"properties,omitempty"`
}

VideoLibraryGetTVShowsParams represents parameters for VideoLibrary.GetTVShows API method

type VideoLibraryGetTVShowsResponse

type VideoLibraryGetTVShowsResponse struct {
	TVShows []TVShow `json:"tvshows"`
}

VideoLibraryGetTVShowsResponse represents the response from VideoLibrary.GetTVShows

Jump to

Keyboard shortcuts

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