xbmc

General functions on Kodi.

Offers classes and functions that provide information about the media currently playing and that allow manipulation of the media player (such as starting a new song). You can also find system information using the functions available in this library.

Functions

audioResume()

Resume Audio engine.

audioSuspend()

Suspend Audio engine.

convertLanguage(language, format)

Returns the given language converted to the given format as a string.

enableNavSounds(yesNo)

Enables/Disables nav sounds

executeJSONRPC(jsonrpccommand)

Execute an JSONRPC command.

executebuiltin(function[, wait])

Execute a built in Kodi function.

executescript(script)

Execute a python script.

getCacheThumbName(path)

Get thumb cache filename.

getCleanMovieTitle(path[, usefoldername])

Get clean movie title and year string if available.

getCondVisibility(condition)

Get visibility conditions

getDVDState()

Returns the dvd state as an integer.

getFreeMem()

Get amount of free memory in MB.

getGlobalIdleTime()

Get the elapsed idle time in seconds.

getIPAddress()

Get the current ip address.

getInfoImage(infotag)

Get filename including path to the InfoImage's thumbnail.

getInfoLabel(cLine)

Get a info label

getLanguage([format, region])

Get the active language.

getLocalizedString(id)

Get a localized 'unicode string'.

getRegion(id)

Returns your regions setting as a string for the specified id.

getSkinDir()

Get the active skin directory.

getSupportedMedia(mediaType)

Get the supported file types for the specific media.

getUserAgent()

Returns Kodi's HTTP UserAgent string

log(msg[, level])

Write a string to Kodi's log file and the debug window.

playSFX(filename[, useCached])

Plays a wav file by filename

restart()

Restart the htpc.

shutdown()

Shutdown the htpc.

skinHasImage(image)

Check skin for presence of Image.

sleep(timemillis)

Sleeps for 'time' (msec).

startServer(iTyp, bStart)

Start or stop a server.

stopSFX()

Stops wav file

Classes

Actor([name, role, order, thumbnail])

`Actor` class used in combination with `InfoTagVideo`.

AudioStreamDetail([channels, codec, language])

Audio stream details class used in combination with `InfoTagVideo`.

InfoTagGame([offscreen])

Kodi's game info tag class.

InfoTagMusic([offscreen])

Kodi's music info tag class.

InfoTagPicture([offscreen])

Kodi's picture info tag class.

InfoTagRadioRDS()

Kodi's radio RDS info tag class.

InfoTagVideo([offscreen])

Kodi's video info tag class.

Keyboard([line, heading, hidden])

Kodi's keyboard class.

Monitor()

Kodi's monitor class.

PlayList(playList)

Kodi's Play `List` class.

Player()

Kodi's player.

RenderCapture()

Kodi's render capture.

SubtitleStreamDetail([language])

Subtitle stream details class used in combination with `InfoTagVideo`.

VideoStreamDetail([width, height, aspect, ...])

Video stream details class used in combination with `InfoTagVideo`.

class xbmc.InfoTagGame(offscreen: bool = False)[source]

Bases: object

Kodi’s game info tag class.

Access and / or modify the game metadata of a ListItem.

@python_v20 New class added.

Example:

...
tag = item.getGameInfoTag()

title = tag.getTitle()
tag.setDeveloper('John Doe')
...
getTitle() str[source]

Gets the title of the game.

Returns:

[string] title

@python_v20 New function added.

getPlatform() str[source]

Gets the platform on which the game is run.

Returns:

[string] platform

@python_v20 New function added.

getGenres() List[str][source]

Gets the genres of the game.

Returns:

[list] genres

@python_v20 New function added.

getPublisher() str[source]

Gets the publisher of the game.

Returns:

[string] publisher

@python_v20 New function added.

getDeveloper() str[source]

Gets the developer of the game.

Returns:

[string] developer

@python_v20 New function added.

getOverview() str[source]

Gets the overview of the game.

Returns:

[string] overview

@python_v20 New function added.

getYear() int[source]

Gets the year in which the game was published.

Returns:

[integer] year

@python_v20 New function added.

getGameClient() str[source]

Gets the add-on ID of the game client executing the game.

Returns:

[string] game client

@python_v20 New function added.

setTitle(title: str) None[source]

Sets the title of the game.

Parameters:

title – string - title.

@python_v20 New function added.

setPlatform(platform: str) None[source]

Sets the platform on which the game is run.

Parameters:

platform – string - platform.

@python_v20 New function added.

setGenres(genres: List[str]) None[source]

Sets the genres of the game.

Parameters:

genres – list - genres.

@python_v20 New function added.

setPublisher(publisher: str) None[source]

Sets the publisher of the game.

Parameters:

publisher – string - publisher.

@python_v20 New function added.

setDeveloper(developer: str) None[source]

Sets the developer of the game.

Parameters:

developer – string - title.

@python_v20 New function added.

setOverview(overview: str) None[source]

Sets the overview of the game.

Parameters:

overview – string - overview.

@python_v20 New function added.

setYear(year: int) None[source]

Sets the year in which the game was published.

Parameters:

year – integer - year.

@python_v20 New function added.

setGameClient(gameClient: str) None[source]

Sets the add-on ID of the game client executing the game.

Parameters:

gameClient – string - game client.

@python_v20 New function added.

class xbmc.InfoTagMusic(offscreen: bool = False)[source]

Bases: object

Kodi’s music info tag class.

Access and / or modify the music metadata of a ListItem.

Example:

...
tag = xbmc.Player().getMusicInfoTag()

title = tag.getTitle()
url   = tag.getURL()
...
getDbId() int[source]

Get identification number of tag in database.

Returns:

[integer] database id.

@python_v18 New function added.

getURL() str[source]

Returns url of source as string from music info tag.

Returns:

[string] Url of source

getTitle() str[source]

Returns the title from music as string on info tag.

Returns:

[string] Music title

getMediaType() str[source]

Get the media type of the music item.

Returns:

[string] media type

Available strings about media type for music:

String

Description

artist

If it is defined as an artist

album

If it is defined as an album

song

If it is defined as a song

@python_v18 New function added.

getArtist() str[source]

Returns the artist from music as string if present.

Returns:

[string] Music artist

getAlbum() str[source]

Returns the album from music tag as string if present.

Returns:

[string] Music album name

getAlbumArtist() str[source]

Returns the album artist from music tag as string if present.

Returns:

[string] Music album artist name

getGenre() str[source]

Returns the genre name from music tag as string if present.

Returns:

[string] Genre name

@python_v20 Deprecated. Use `getGenres()` instead.

getGenres() List[str][source]

Returns the list of genres from music tag if present.

Returns:

[list]`List` of genres

@python_v20 New function added.

getDuration() int[source]

Returns the duration of music as integer from info tag.

Returns:

[integer] Duration

getYear() int[source]

Returns the year of music as integer from info tag.

Returns:

[integer] Year

@python_v20 New function added.

getRating() int[source]

Returns the scraped rating as integer.

Returns:

[integer] Rating

getUserRating() int[source]

Returns the user rating as integer (-1 if not existing)

Returns:

[integer] User rating

getTrack() int[source]

Returns the track number (if present) from music info tag as integer.

Returns:

[integer] Track number

getDisc() int[source]

Returns the disk number (if present) from music info tag as integer.

Returns:

[integer] Disc number

getReleaseDate() str[source]

Returns the release date as string from music info tag (if present).

Returns:

[string] Release date

getListeners() int[source]

Returns the listeners as integer from music info tag.

Returns:

[integer] Listeners

getPlayCount() int[source]

Returns the number of carried out playbacks.

Returns:

[integer] Playback count

getLastPlayed() str[source]

Returns last played time as string from music info tag.

Returns:

[string] Last played date / time on tag

@python_v20 Deprecated. Use `getLastPlayedAsW3C()` instead.

getLastPlayedAsW3C() str[source]

Returns last played time as string in W3C format (YYYY-MM-DDThh:mm:ssTZD).

Returns:

[string] Last played datetime (W3C)

@python_v20 New function added.

getComment() str[source]

Returns comment as string from music info tag.

Returns:

[string] Comment on tag

getLyrics() str[source]

Returns a string from lyrics.

Returns:

[string] Lyrics on tag

getMusicBrainzTrackID() str[source]

Returns the MusicBrainz Recording ID from music info tag (if present).

Returns:

[string] MusicBrainz Recording ID

@python_v19 New function added.

getMusicBrainzArtistID() List[str][source]

Returns the MusicBrainz Artist IDs from music info tag (if present).

Returns:

[list] MusicBrainz Artist IDs

@python_v19 New function added.

getMusicBrainzAlbumID() str[source]

Returns the MusicBrainz Release ID from music info tag (if present).

Returns:

[string] MusicBrainz Release ID

@python_v19 New function added.

getMusicBrainzReleaseGroupID() str[source]

Returns the MusicBrainz Release Group ID from music info tag (if present).

Returns:

[string] MusicBrainz Release Group ID

@python_v19 New function added.

getMusicBrainzAlbumArtistID() List[str][source]

Returns the MusicBrainz Release Artist IDs from music info tag (if present).

Returns:

[list] MusicBrainz Release Artist IDs

@python_v19 New function added.

setDbId(dbId: int, type: str) None[source]

Set the database identifier of the music item.

Parameters:
  • dbId – integer - Database identifier.

  • type – string - Media type of the item.

@python_v20 New function added.

setURL(url: str) None[source]

Set the URL of the music item.

Parameters:

url – string - URL.

@python_v20 New function added.

setMediaType(mediaType: str) None[source]

Set the media type of the music item.

Parameters:

mediaType – string - Media type.

@python_v20 New function added.

setTrack(track: int) None[source]

Set the track number of the song.

Parameters:

track – integer - Track number.

@python_v20 New function added.

setDisc(disc: int) None[source]

Set the disc number of the song.

Parameters:

disc – integer - Disc number.

@python_v20 New function added.

setDuration(duration: int) None[source]

Set the duration of the song.

Parameters:

duration – integer - Duration in seconds.

@python_v20 New function added.

setYear(year: int) None[source]

Set the year of the music item.

Parameters:

year – integer - Year.

@python_v20 New function added.

setReleaseDate(releaseDate: str) None[source]

Set the release date of the music item.

Parameters:

releaseDate – string - Release date in ISO8601 format (YYYY, YYYY-MM or YYYY-MM-DD).

@python_v20 New function added.

setListeners(listeners: int) None[source]

Set the number of listeners of the music item.

Parameters:

listeners – integer - Number of listeners.

@python_v20 New function added.

setPlayCount(playcount: int) None[source]

Set the playcount of the music item.

Parameters:

playcount – integer - Playcount.

@python_v20 New function added.

setGenres(genres: List[str]) None[source]

Set the genres of the music item.

Parameters:

genres – list - Genres.

@python_v20 New function added.

setAlbum(album: str) None[source]

Set the album of the music item.

Parameters:

album – string - Album.

@python_v20 New function added.

setArtist(artist: str) None[source]

Set the artist(s) of the music item.

Parameters:

artist – string - Artist(s).

@python_v20 New function added.

setAlbumArtist(albumArtist: str) None[source]

Set the album artist(s) of the music item.

Parameters:

albumArtist – string - Album artist(s).

@python_v20 New function added.

setTitle(title: str) None[source]

Set the title of the music item.

Parameters:

title – string - Title.

@python_v20 New function added.

setRating(rating: float) None[source]

Set the rating of the music item.

Parameters:

rating – float - Rating.

@python_v20 New function added.

setUserRating(userrating: int) None[source]

Set the user rating of the music item.

Parameters:

userrating – integer - User rating.

@python_v20 New function added.

setLyrics(lyrics: str) None[source]

Set the lyrics of the song.

Parameters:

lyrics – string - Lyrics.

@python_v20 New function added.

setLastPlayed(lastPlayed: str) None[source]

Set the last played date of the music item.

Parameters:

lastPlayed – string - Last played date (YYYY-MM-DD HH:MM:SS).

@python_v20 New function added.

setMusicBrainzTrackID(musicBrainzTrackID: str) None[source]

Set the MusicBrainz track ID of the song.

Parameters:

musicBrainzTrackID – string - MusicBrainz track ID.

@python_v20 New function added.

setMusicBrainzArtistID(musicBrainzArtistID: List[str]) None[source]

Set the MusicBrainz artist IDs of the music item.

Parameters:

musicBrainzArtistID – list - MusicBrainz artist IDs.

@python_v20 New function added.

setMusicBrainzAlbumID(musicBrainzAlbumID: str) None[source]

Set the MusicBrainz album ID of the music item.

Parameters:

musicBrainzAlbumID – string - MusicBrainz album ID.

@python_v20 New function added.

setMusicBrainzReleaseGroupID(musicBrainzReleaseGroupID: str) None[source]

Set the MusicBrainz release group ID of the music item.

Parameters:

musicBrainzReleaseGroupID – string - MusicBrainz release group ID.

@python_v20 New function added.

setMusicBrainzAlbumArtistID(musicBrainzAlbumArtistID: List[str]) None[source]

Set the MusicBrainz album artist IDs of the music item.

Parameters:

musicBrainzAlbumArtistID – list - MusicBrainz album artist IDs.

@python_v20 New function added.

setComment(comment: str) None[source]

Set the comment of the music item.

Parameters:

comment – string - Comment.

@python_v20 New function added.

class xbmc.InfoTagPicture(offscreen: bool = False)[source]

Bases: object

Kodi’s picture info tag class.

Access and / or modify the picture metadata of a ListItem.

@python_v20 New class added.

Example:

...
tag = item.getPictureInfoTag()

datetime_taken  = tag.getDateTimeTaken()
tag.setResolution(1920, 1080)
...
getResolution() str[source]

Get the resolution of the picture in the format “w x h”.

Returns:

[string] Resolution of the picture in the format “w x h”.

@python_v20 New function added.

setResolution(width: int, height: int) None[source]

Sets the resolution of the picture.

Parameters:
  • width – int - Width of the picture in pixels.

  • height – int - Height of the picture in pixels.

@python_v20 New function added.

setDateTimeTaken(datetimetaken: str) None[source]

Sets the date and time at which the picture was taken in W3C format. The following formats are supported:

YYYY

YYYY-MM-DD

YYYY-MM-DDThh:mm[TZD]

YYYY-MM-DDThh:mm:ss[TZD] where the timezone (TZD) is always optional and can be in one of the following formats:

Z (for UTC)

+hh:mm

-hh:mm

Parameters:

datetimetaken – string - Date and time at which the picture was taken in W3C format.

@python_v20 New function added.

class xbmc.InfoTagRadioRDS[source]

Bases: object

Kodi’s radio RDS info tag class.

To get radio RDS info tag data of currently played PVR radio channel source.

Note

Info tag load is only be possible from present player class. Also is all the data variable from radio channels and not known on beginning of radio receiving.

Example:

...
tag = xbmc.Player().getRadioRDSInfoTag()

title  = tag.getTitle()
artist = tag.getArtist()
...
getTitle() str[source]

Title of the item on the air; i.e. song title.

Returns:

Title

getBand() str[source]

Band of the item on air.

Returns:

Band

getArtist() str[source]

Artist of the item on air.

Returns:

Artist

getComposer() str[source]

Get the Composer of the music.

Returns:

Composer

getConductor() str[source]

Get the Conductor of the Band.

Returns:

Conductor

getAlbum() str[source]

Album of item on air.

Returns:

Album name

getComment() str[source]

Get Comment text from channel.

Returns:

Comment

getAlbumTrackNumber() int[source]

Get the album track number of currently sended music.

Returns:

Track Number

getInfoNews() str[source]

Get News informations.

Returns:

News Information

getInfoNewsLocal() str[source]

Get Local news informations.

Returns:

Local News Information

getInfoSport() str[source]

Get Sport informations.

Returns:

Sport Information

getInfoStock() str[source]

Get Stock informations.

Returns:

Stock Information

getInfoWeather() str[source]

Get Weather informations.

Returns:

Weather Information

getInfoHoroscope() str[source]

Get Horoscope informations.

Returns:

Horoscope Information

getInfoCinema() str[source]

Get Cinema informations.

Returns:

Cinema Information

getInfoLottery() str[source]

Get Lottery informations.

Returns:

Lottery Information

getInfoOther() str[source]

Get other informations.

Returns:

Other Information

getEditorialStaff() str[source]

Get Editorial Staff names.

Returns:

Editorial Staff

getProgStation() str[source]

Name describing station.

Returns:

Program Station

getProgStyle() str[source]

The the radio channel style currently used.

Returns:

Program Style

getProgHost() str[source]

Host of current radio show.

Returns:

Program Host

getProgWebsite() str[source]

Link to URL (web page) for radio station homepage.

Returns:

Program Website

getProgNow() str[source]

Current radio program show.

Returns:

Program Now

getProgNext() str[source]

Next program show.

Returns:

Program Next

getPhoneHotline() str[source]

Telephone number of the radio station’s hotline.

Returns:

Phone Hotline

getEMailHotline() str[source]

Email address of the radio station’s studio.

Returns:

EMail Hotline

getPhoneStudio() str[source]

Telephone number of the radio station’s studio.

Returns:

Phone Studio

getEMailStudio() str[source]

Email address of radio station studio.

Returns:

EMail Studio

getSMSStudio() str[source]

SMS (Text Messaging) number for studio.

Returns:

SMS Studio

class xbmc.Actor(name: str = '', role: str = '', order: int = -1, thumbnail: str = '')[source]

Bases: object

`Actor` class used in combination with `InfoTagVideo`.

Represents a single actor in the cast of a video item wrapped by InfoTagVideo.

@python_v20 New class added.

Example:

...
actor = xbmc.Actor('Sean Connery', 'James Bond', order=1)
...
getName() str[source]

Get the name of the actor.

Returns:

[string] Name of the actor

@python_v20 New function added.

getRole() str[source]

Get the role of the actor in the specific video item.

Returns:

[string] Role of the actor in the specific video item

@python_v20 New function added.

getOrder() int[source]

Get the order of the actor in the cast of the specific video item.

Returns:

[integer] Order of the actor in the cast of the specific video item

@python_v20 New function added.

getThumbnail() str[source]

Get the path / URL to the thumbnail of the actor.

Returns:

[string] Path / URL to the thumbnail of the actor

@python_v20 New function added.

setName(name: str) None[source]

Set the name of the actor.

Parameters:

name – string - Name of the actor.

@python_v20 New function added.

setRole(role: str) None[source]

Set the role of the actor in the specific video item.

Parameters:

role – string - Role of the actor in the specific video item.

@python_v20 New function added.

setOrder(order: int) None[source]

Set the order of the actor in the cast of the specific video item.

Parameters:

order – integer - Order of the actor in the cast of the specific video item.

@python_v20 New function added.

setThumbnail(thumbnail: str) None[source]

Set the path / URL to the thumbnail of the actor.

Parameters:

thumbnail – string - Path / URL to the thumbnail of the actor.

@python_v20 New function added.

class xbmc.VideoStreamDetail(width: int = 0, height: int = 0, aspect: float = 0.0, duration: int = 0, codec: str = '', stereomode: str = '', language: str = '', hdrtype: str = '')[source]

Bases: object

Video stream details class used in combination with `InfoTagVideo`.

Represents a single selectable video stream for a video item wrapped by InfoTagVideo.

@python_v20 New class added.

Example:

...
videostream = xbmc.VideoStreamDetail(1920, 1080, language='English')
...
getWidth() int[source]

Get the width of the video stream in pixel.

Returns:

[integer] Width of the video stream

@python_v20 New function added.

getHeight() int[source]

Get the height of the video stream in pixel.

Returns:

[integer] Height of the video stream

@python_v20 New function added.

getAspect() float[source]

Get the aspect ratio of the video stream.

Returns:

[float] Aspect ratio of the video stream

@python_v20 New function added.

getDuration() int[source]

Get the duration of the video stream in seconds.

Returns:

[float] Duration of the video stream in seconds

@python_v20 New function added.

getCodec() str[source]

Get the codec of the stream.

Returns:

[string] Codec of the stream

@python_v20 New function added.

getStereoMode() str[source]

Get the stereo mode of the video stream.

Returns:

[string] Stereo mode of the video stream

@python_v20 New function added.

getLanguage() str[source]

Get the language of the stream.

Returns:

[string] Language of the stream

@python_v20 New function added.

getHDRType() str[source]

Get the HDR type of the stream.

Returns:

[string] HDR type of the stream

@python_v20 New function added.

setWidth(width: int) None[source]

Set the width of the video stream in pixel.

Parameters:

width – integer - Width of the video stream in pixel.

@python_v20 New function added.

setHeight(height: int) None[source]

Set the height of the video stream in pixel.

Parameters:

height – integer - Height of the video stream in pixel.

@python_v20 New function added.

setAspect(aspect: float) None[source]

Set the aspect ratio of the video stream.

Parameters:

aspect – float - Aspect ratio of the video stream.

@python_v20 New function added.

setDuration(duration: int) None[source]

Set the duration of the video stream in seconds.

Parameters:

duration – integer - Duration of the video stream in seconds.

@python_v20 New function added.

setCodec(codec: str) None[source]

Set the codec of the stream.

Parameters:

codec – string - Codec of the stream.

@python_v20 New function added.

setStereoMode(stereomode: str) None[source]

Set the stereo mode of the video stream.

Parameters:

stereomode – string - Stereo mode of the video stream.

@python_v20 New function added.

setLanguage(language: str) None[source]

Set the language of the stream.

Parameters:

language – string - Language of the stream.

@python_v20 New function added.

setHDRType(hdrtype: str) None[source]

Set the HDR type of the stream.

Parameters:

hdrtype – string - HDR type of the stream. The following types are supported: dolbyvision, hdr10, hlg

@python_v20 New function added.

class xbmc.AudioStreamDetail(channels: int = -1, codec: str = '', language: str = '')[source]

Bases: object

Audio stream details class used in combination with `InfoTagVideo`.

Represents a single selectable audio stream for a video item wrapped by InfoTagVideo.

@python_v20 New class added.

Example:

...
audiostream = xbmc.AudioStreamDetail(6, 'DTS', 'English')
...
getChannels() int[source]

Get the number of channels in the stream.

Returns:

[integer] Number of channels in the stream

@python_v20 New function added.

getCodec() str[source]

Get the codec of the stream.

Returns:

[string] Codec of the stream

@python_v20 New function added.

getLanguage() str[source]

Get the language of the stream.

Returns:

[string] Language of the stream

@python_v20 New function added.

setChannels(channels: int) None[source]

Set the number of channels in the stream.

Parameters:

channels – integer - Number of channels in the stream.

@python_v20 New function added.

setCodec(codec: str) None[source]

Set the codec of the stream.

Parameters:

codec – string - Codec of the stream.

@python_v20 New function added.

setLanguage(language: str) None[source]

Set the language of the stream.

Parameters:

language – string - Language of the stream.

@python_v20 New function added.

class xbmc.SubtitleStreamDetail(language: str = '')[source]

Bases: object

Subtitle stream details class used in combination with `InfoTagVideo`.

Represents a single selectable subtitle stream for a video item wrapped by InfoTagVideo.

@python_v20 New class added.

Example:

...
subtitlestream = xbmc.SubtitleStreamDetail('English')
...
getLanguage() str[source]

Get the language of the stream.

Returns:

[string] Language of the stream

@python_v20 New function added.

setLanguage(language: str) None[source]

Set the language of the stream.

Parameters:

language – string - Language of the stream.

@python_v20 New function added.

class xbmc.InfoTagVideo(offscreen: bool = False)[source]

Bases: object

Kodi’s video info tag class.

Access and / or modify the video metadata of a ListItem.

Example:

...
tag = xbmc.Player().getVideoInfoTag()

title = tag.getTitle()
file  = tag.getFile()
...
getDbId() int[source]

Get identification number of tag in database

Returns:

[integer] database id

@python_v17 New function added.

getDirector() str[source]

Getfilm director who has made the film (if present).

Returns:

[string] Film director name.

@python_v20 Deprecated. Use `getDirectors()` instead.

getDirectors() List[str][source]

Get a list offilm directors who have made the film (if present).

Returns:

[list]`List` of film director names.

@python_v20 New function added.

getWritingCredits() str[source]

Get the writing credits if present from video info tag.

Returns:

[string] Writing credits

@python_v20 Deprecated. Use `getWriters()` instead.

getWriters() List[str][source]

Get the list of writers (if present) from video info tag.

Returns:

[list] List of writers

@python_v20 New function added.

getGenre() str[source]

To get theVideo Genre if available.

Returns:

[string] Genre name

@python_v20 Deprecated. Use `getGenres()` instead.

getGenres() List[str][source]

Get the list ofVideo Genres if available.

Returns:

[list]`List` of genres

@python_v20 New function added.

getTagLine() str[source]

Get video tag line if available.

Returns:

[string] Video tag line

getPlotOutline() str[source]

Get the outline plot of the video if present.

Returns:

[string] Outline plot

getPlot() str[source]

Get the plot of the video if present.

Returns:

[string] Plot

getPictureURL() str[source]

Get a picture URL of the video to show as screenshot.

Returns:

[string] Picture URL

getTitle() str[source]

Get the video title.

Returns:

[string] Video title

getTVShowTitle() str[source]

Get the video TV show title.

Returns:

[string] TV show title

@python_v17 New function added.

getMediaType() str[source]

Get the media type of the video.

Returns:

[string] media type

Available strings about media type for video:

String

Description

video

For normal video

set

For a selection of video

musicvideo

To define it as music video

movie

To define it as normal movie

tvshow

If this is it defined as tvshow

season

The type is used as a series season

episode

The type is used as a series episode

@python_v17 New function added.

getVotes() str[source]

Get the video votes if available from video info tag.

Returns:

[string] Votes

@python_v20 Deprecated. Use `getVotesAsInt()` instead.

getVotesAsInt(type: str = '') int[source]

Get the votes of the rating (if available) as an integer.

Parameters:

type – [opt] string - the type of the rating. Some rating type values (any string possible):

Label

Type

imdb

string - type name

tvdb

string - type name

tmdb

string - type name

anidb

string - type name

Returns:

[integer] Votes

@python_v20 New function added.

getCast() str[source]

To get the cast of the video when available.

Returns:

[string] Video casts

@python_v20 Deprecated. Use `getActors()` instead.

getActors() List[Actor][source]

Get the cast of the video if available.

Returns:

[list]`List` of actors

@python_v20 New function added.

getFile() str[source]

To get the video file name.

Returns:

[string] File name

getPath() str[source]

To get the path where the video is stored.

Returns:

[string] Path

getFilenameAndPath() str[source]

To get the full path with filename where the video is stored.

Returns:

[string] File name and Path

@python_v19 New function added.

getIMDBNumber() str[source]

To get theIMDb number of the video (if present).

Returns:

[string] IMDb number

getSeason() int[source]

To get season number of a series

Returns:

[integer] season number

@python_v17 New function added.

getEpisode() int[source]

To get episode number of a series

Returns:

[integer] episode number

@python_v17 New function added.

getYear() int[source]

Get production year of video if present.

Returns:

[integer] Production Year

getRating(type: str = '') float[source]

Get the video rating if present as float (double where supported).

Parameters:

type – [opt] string - the type of the rating. Some rating type values (any string possible):

Label

Type

imdb

string - type name

tvdb

string - type name

tmdb

string - type name

anidb

string - type name

Returns:

[float] The rating of the video

@python_v20 Optional type parameter added.

getUserRating() int[source]

Get the user rating if present as integer.

Returns:

[integer] The user rating of the video

getPlayCount() int[source]

To get the number of plays of the video.

Returns:

[integer] Play Count

getLastPlayed() str[source]

Get the last played date / time as string.

Returns:

[string] Last played date / time

@python_v20 Deprecated. Use `getLastPlayedAsW3C()` instead.

getLastPlayedAsW3C() str[source]

Get last played datetime as string in W3C format (YYYY-MM-DDThh:mm:ssTZD).

Returns:

[string] Last played datetime (W3C)

@python_v20 New function added.

getOriginalTitle() str[source]

To get the original title of the video.

Returns:

[string] Original title

getPremiered() str[source]

To getpremiered date of the video, if available.

Returns:

[string]

@python_v20 Deprecated. Use `getPremieredAsW3C()` instead.

getPremieredAsW3C() str[source]

Getpremiered date as string in W3C format (YYYY-MM-DD).

Returns:

[string] Premiered date (W3C)

@python_v20 New function added.

getFirstAired() str[source]

Returns first aired date as string from info tag.

Returns:

[string] First aired date

@python_v20 Deprecated. Use `getFirstAiredAsW3C()` instead.

getFirstAiredAsW3C() str[source]

Get first aired date as string in W3C format (YYYY-MM-DD).

Returns:

[string] First aired date (W3C)

@python_v20 New function added.

getTrailer() str[source]

To get the path where the trailer is stored.

Returns:

[string] Trailer path

@python_v17 New function added.

getArtist() List[str][source]

To get the artist name (for musicvideos)

Returns:

[List[str]] Artist name

@python_v18 New function added.

getAlbum() str[source]

To get the album name (for musicvideos)

Returns:

[string] Album name

@python_v18 New function added.

getTrack() int[source]

To get the track number (for musicvideos)

Returns:

[int] Track number

@python_v18 New function added.

getDuration() int[source]

To get the duration

Returns:

[unsigned int] Duration

@python_v18 New function added.

getResumeTime() float[source]

Gets the resume time of the video item.

Returns:

[double] Resume time

@python_v20 New function added.

getResumeTimeTotal() float[source]

Gets the total duration stored with the resume time of the video item.

Returns:

[double] Total duration stored with the resume time

@python_v20 New function added.

getUniqueID(key: str) str[source]

Get the unique ID of the given key. A unique ID is an identifier used by a (online) video database used to identify a video in its database.

Parameters:

key – string - uniqueID name. Some default uniqueID values (any string possible):

Label

Type

imdb

string - uniqueid name

tvdb

string - uniqueid name

tmdb

string - uniqueid name

anidb

string - uniqueid name

@python_v20 New function added.

setUniqueID(uniqueid: str, type: str = '', isdefault: bool = False) None[source]

Set the given unique ID. A unique ID is an identifier used by a (online) video database used to identify a video in its database.

Parameters:
  • uniqueid – string - value of the unique ID.

  • type – [opt] string - type / label of the unique ID.

  • isdefault – [opt] bool - whether the given unique ID is the default unique ID.

@python_v20 New function added.

setUniqueIDs(uniqueIDs: Dict[str, str], defaultuniqueid: str = '') None[source]

Set the given unique IDs. A unique ID is an identifier used by a (online) video database used to identify a video in its database.

Parameters:
  • values – dictionary - pairs of{ ‘label: ‘value’ }`.

  • defaultuniqueid – [opt] string - the name of default uniqueID.

Some example values (any string possible):

Label

Type

imdb

string - uniqueid name

tvdb

string - uniqueid name

tmdb

string - uniqueid name

anidb

string - uniqueid name

@python_v20 New function added.

setDbId(dbid: int) None[source]

Set the database identifier of the video item.

Parameters:

dbid – integer - Database identifier.

@python_v20 New function added.

setYear(year: int) None[source]

Set the year of the video item.

Parameters:

year – integer - Year.

@python_v20 New function added.

setEpisode(episode: int) None[source]

Set the episode number of the episode.

Parameters:

episode – integer - Episode number.

@python_v20 New function added.

setSeason(season: int) None[source]

Set the season number of the video item.

Parameters:

season – integer - Season number.

@python_v20 New function added.

setSortEpisode(sortepisode: int) None[source]

Set the episode sort number of the episode.

Parameters:

sortepisode – integer - Episode sort number.

@python_v20 New function added.

setSortSeason(sortseason: int) None[source]

Set the season sort number of the season.

Parameters:

sortseason – integer - Season sort number.

@python_v20 New function added.

setEpisodeGuide(episodeguide: str) None[source]

Set the episode guide of the video item.

Parameters:

episodeguide – string - Episode guide.

@python_v20 New function added.

setTop250(top250: int) None[source]

Set the top 250 number of the video item.

Parameters:

top250 – integer - Top 250 number.

@python_v20 New function added.

setSetId(setid: int) None[source]

Set the movie set identifier of the video item.

Parameters:

setid – integer - Set identifier.

@python_v20 New function added.

setTrackNumber(tracknumber: int) None[source]

Set the track number of the music video item.

Parameters:

tracknumber – integer - Track number.

@python_v20 New function added.

setRating(rating: float, votes: int = 0, type: str = '', isdefault: bool = False) None[source]

Set the rating of the video item.

Parameters:
  • rating – float - Rating number.

  • votes – integer - Number of votes.

  • type – string - Type of the rating.

  • isdefault – bool - Whether the rating is the default or not.

@python_v20 New function added.

setRatings(ratings: Dict[str, Tuple[float, int]], defaultrating: str = '') None[source]

Set the ratings of the video item.

Parameters:
  • ratings – dictionary -{ ‘type: (rating, votes) }`.

  • defaultrating – string - Type / Label of the default rating.

@python_v20 New function added.

setUserRating(userrating: int) None[source]

Set the user rating of the video item.

Parameters:

userrating – integer - User rating.

@python_v20 New function added.

setPlaycount(playcount: int) None[source]

Set the playcount of the video item.

Parameters:

playcount – integer - Playcount.

@python_v20 New function added.

setMpaa(mpaa: str) None[source]

Set the MPAA rating of the video item.

Parameters:

mpaa – string - MPAA rating.

@python_v20 New function added.

setPlot(plot: str) None[source]

Set the plot of the video item.

Parameters:

plot – string - Plot.

@python_v20 New function added.

setPlotOutline(plotoutline: str) None[source]

Set the plot outline of the video item.

Parameters:

plotoutline – string - Plot outline.

@python_v20 New function added.

setTitle(title: str) None[source]

Set the title of the video item.

Parameters:

title – string - Title.

@python_v20 New function added.

setOriginalTitle(originaltitle: str) None[source]

Set the original title of the video item.

Parameters:

originaltitle – string - Original title.

@python_v20 New function added.

setSortTitle(sorttitle: str) None[source]

Set the sort title of the video item.

Parameters:

sorttitle – string - Sort title.

@python_v20 New function added.

setTagLine(tagline: str) None[source]

Set the tagline of the video item.

Parameters:

tagline – string - Tagline.

@python_v20 New function added.

setTvShowTitle(tvshowtitle: str) None[source]

Set the TV show title of the video item.

Parameters:

tvshowtitle – string - TV show title.

@python_v20 New function added.

setTvShowStatus(status: str) None[source]

Set the TV show status of the video item.

Parameters:

status – string - TV show status.

@python_v20 New function added.

setGenres(genre: List[str]) None[source]

Set the genres of the video item.

Parameters:

genre – list - Genres.

@python_v20 New function added.

setCountries(countries: List[str]) None[source]

Set the countries of the video item.

Parameters:

countries – list - Countries.

@python_v20 New function added.

setDirectors(directors: List[str]) None[source]

Set the directors of the video item.

Parameters:

directors – list - Directors.

@python_v20 New function added.

setStudios(studios: List[str]) None[source]

Set the studios of the video item.

Parameters:

studios – list - Studios.

@python_v20 New function added.

setWriters(writers: List[str]) None[source]

Set the writers of the video item.

Parameters:

writers – list - Writers.

@python_v20 New function added.

setDuration(duration: int) None[source]

Set the duration of the video item.

Parameters:

duration – integer - Duration in seconds.

@python_v20 New function added.

setPremiered(premiered: str) None[source]

Set the premiere date of the video item.

Parameters:

premiered – string - Premiere date.

@python_v20 New function added.

setSet(set: str) None[source]

Set the movie set (name) of the video item.

Parameters:

set – string - Movie set (name).

@python_v20 New function added.

setSetOverview(setoverview: str) None[source]

Set the movie set overview of the video item.

Parameters:

setoverview – string - Movie set overview.

@python_v20 New function added.

setTags(tags: List[str]) None[source]

Set the tags of the video item.

Parameters:

tags – list - Tags.

@python_v20 New function added.

setProductionCode(productioncode: str) None[source]

Set the production code of the video item.

Parameters:

productioncode – string - Production code.

@python_v20 New function added.

setFirstAired(firstaired: str) None[source]

Set the first aired date of the video item.

Parameters:

firstaired – string - First aired date.

@python_v20 New function added.

setLastPlayed(lastplayed: str) None[source]

Set the last played date of the video item.

Parameters:

lastplayed – string - Last played date (YYYY-MM-DD HH:MM:SS).

@python_v20 New function added.

setAlbum(album: str) None[source]

Set the album of the video item.

Parameters:

album – string - Album.

@python_v20 New function added.

setVotes(votes: int) None[source]

Set the number of votes of the video item.

Parameters:

votes – integer - Number of votes.

@python_v20 New function added.

setTrailer(trailer: str) None[source]

Set the trailer of the video item.

Parameters:

trailer – string - Trailer.

@python_v20 New function added.

setPath(path: str) None[source]

Set the path of the video item.

Parameters:

path – string - Path.

@python_v20 New function added.

setFilenameAndPath(filenameandpath: str) None[source]

Set the filename and path of the video item.

Parameters:

filenameandpath – string - Filename and path.

@python_v20 New function added.

setIMDBNumber(imdbnumber: str) None[source]

Set the IMDb number of the video item.

Parameters:

imdbnumber – string - IMDb number.

@python_v20 New function added.

setDateAdded(dateadded: str) None[source]

Set the date added of the video item.

Parameters:

dateadded – string - Date added (YYYY-MM-DD HH:MM:SS).

@python_v20 New function added.

setMediaType(mediatype: str) None[source]

Set the media type of the video item.

Parameters:

mediatype – string - Media type.

@python_v20 New function added.

Set the TV show links of the movie.

Parameters:

showlinks – list - TV show links.

@python_v20 New function added.

setArtists(artists: List[str]) None[source]

Set the artists of the music video item.

Parameters:

artists – list - Artists.

@python_v20 New function added.

setCast(actors: List[Actor]) None[source]

Set the cast / actors of the video item.

Parameters:

actors – list - Cast / Actors.

@python_v20 New function added.

setResumePoint(time: float, totaltime: float = 0.0) None[source]

Set the resume point of the video item.

Parameters:
  • time – float - Resume point in seconds.

  • totaltime – float - Total duration in seconds.

@python_v20 New function added.

addSeason(number: int, name: str = '') None[source]

Add a season with name. It needs at least the season number.

Parameters:
  • number – int - the number of the season.

  • name – string - the name of the season. Default “”.

@python_v20 New function added.

Example:

...
# addSeason(number, name))
infotagvideo.addSeason(1, "Murder House")
...
addSeasons(namedseasons: List[Tuple[int, str]]) None[source]

Add named seasons to the TV show.

Parameters:

namedseasons – list -[ (season, name) ].

@python_v20 New function added.

addVideoStream(stream: VideoStreamDetail) None[source]

Add a video stream to the video item.

Parameters:

streamVideoStreamDetail - Video stream.

@python_v20 New function added.

addAudioStream(stream: AudioStreamDetail) None[source]

Add an audio stream to the video item.

Parameters:

streamAudioStreamDetail - Audio stream.

@python_v20 New function added.

addSubtitleStream(stream: SubtitleStreamDetail) None[source]

Add a subtitle stream to the video item.

Parameters:

streamSubtitleStreamDetail - Subtitle stream.

@python_v20 New function added.

addAvailableArtwork(url: str, arttype: str = '', preview: str = '', referrer: str = '', cache: str = '', post: bool = False, isgz: bool = False, season: int = -1) None[source]

Add an image to available artworks (needed for video scrapers)

Parameters:
  • url – string - image path url

  • arttype – string - image type

  • preview – [opt] string - image preview path url

  • referrer – [opt] string - referrer url

  • cache – [opt] string - filename in cache

  • post – [opt] bool - use post to retrieve the image (default false)

  • isgz – [opt] bool - use gzip to retrieve the image (default false)

  • season – [opt] integer - number of season in case of season thumb

@python_v20 New function added.

Example:

...
infotagvideo.addAvailableArtwork(path_to_image_1, "thumb")
...
class xbmc.Keyboard(line: str = '', heading: str = '', hidden: bool = False)[source]

Bases: object

Kodi’s keyboard class.

Creates a new Keyboard object with default text heading and hidden input flag if supplied.

Parameters:
  • default – : [opt] string - default text entry.

  • heading – : [opt] string - keyboard heading.

  • hidden – : [opt] boolean - True for hidden text entry.

Example:

..
kb = xbmc.Keyboard('default', 'heading', True)
kb.setDefault('password') # optional
kb.setHeading('Enter password') # optional
kb.setHiddenInput(True) # optional
kb.doModal()
if (kb.isConfirmed()):
text = kb.getText()
..
doModal(autoclose: int = 0) None[source]

Show keyboard and wait for user action.

Parameters:

autoclose – [opt] integer - milliseconds to autoclose dialog. (default=do not autoclose)

Example:

..
kb.doModal(30000)
..
setDefault(line: str = '') None[source]

Set the default text entry.

Parameters:

line – string - default text entry.

Example:

..
kb.setDefault('password')
..
setHiddenInput(hidden: bool = False) None[source]

Allows hidden text entry.

Parameters:

hidden – boolean - True for hidden text entry.

Example:

..
kb.setHiddenInput(True)
..
setHeading(heading: str) None[source]

Set the keyboard heading.

Parameters:

heading – string - keyboard heading.

Example:

..
kb.setHeading('Enter password')
..
getText() str[source]

Returns the user input as a string.

Note

This will always return the text entry even if you cancel the keyboard. Use the isConfirmed() method to check if user cancelled the keyboard.

Returns:

get the in keyboard entered text

Example:

..
text = kb.getText()
..
isConfirmed() bool[source]

Returns False if the user cancelled the input.

Returns:

true if confirmed, if cancelled false

Example:

..
if (kb.isConfirmed()):
..
class xbmc.Monitor[source]

Bases: object

Kodi’s monitor class.

Creates a new monitor to notify addon about changes.

onSettingsChanged() None[source]

onSettingsChanged method.

Will be called when addon settings are changed

onScreensaverActivated() None[source]

onScreensaverActivated method.

Will be called when screensaver kicks in

onScreensaverDeactivated() None[source]

onScreensaverDeactivated method.

Will be called when screensaver goes off

onDPMSActivated() None[source]

onDPMSActivated method.

Will be called when energysaving/DPMS gets active

onDPMSDeactivated() None[source]

onDPMSDeactivated method.

Will be called when energysaving/DPMS is turned off

onScanStarted(library: str) None[source]

onScanStarted method.

Parameters:

library – Video / music as string

Note

Will be called when library clean has ended and return video or music to indicate which library is being scanned

@python_v14 New function added.

onScanFinished(library: str) None[source]

onScanFinished method.

Parameters:

library – Video / music as string

Note

Will be called when library clean has ended and return video or music to indicate which library has been scanned

@python_v14 New function added.

onCleanStarted(library: str) None[source]

onCleanStarted method.

Parameters:

library – Video / music as string

Note

Will be called when library clean has ended and return video or music to indicate which library has been cleaned

@python_v14 New function added.

onCleanFinished(library: str) None[source]

onCleanFinished method.

Parameters:

library – Video / music as string

Note

Will be called when library clean has ended and return video or music to indicate which library has been finished

@python_v14 New function added.

onNotification(sender: str, method: str, data: str) None[source]

onNotification method.

Parameters:
  • sender – Sender of the notification

  • method – Name of the notification

  • data – JSON-encoded data of the notification

Note

Will be called when Kodi receives or sends a notification

@python_v13 New function added.

waitForAbort(timeout: float = -1) bool[source]

Wait for Abort

Block until abort is requested, or until timeout occurs. If an abort requested have already been made, return immediately.

Parameters:

timeout – [opt] float - timeout in seconds. Default: no timeout.

Returns:

True when abort have been requested, False if a timeout is given and the operation times out.

@python_v14 New function added.

Example:

..
monitor = xbmc.Monitor()
# do something
monitor.waitForAbort(10) # sleeps for 10 secs or returns early if kodi aborts
if monitor.abortRequested():
# abort was requested to Kodi (e.g. shutdown), do your cleanup logic
..
abortRequested() bool[source]

Returns True if abort has been requested.

Returns:

True if requested

@python_v14 New function added.

class xbmc.Player[source]

Bases: object

Kodi’s player.

To become and create the class to play something.

Example:

...
xbmc.Player().play(url, listitem, windowed)
...
play(item: str | PlayList = '', listitem: xbmcgui.ListItem | None = None, windowed: bool = False, startpos: int = -1) None[source]

Play an item.

Parameters:
  • item – [opt] string - filename, url or playlist

  • listitem – [opt] listitem - used with setInfo() to set different infolabels.

  • windowed – [opt] bool - true=play video windowed, false=play users preference.(default)

  • startpos – [opt] int - starting position when playing a playlist. Default = -1

Note

If item is not given then the Player will try to play the current item in the current playlist. You can use the above as keywords for arguments and skip certain optional arguments. Once you use a keyword, all following arguments require the keyword.

Example:

...
listitem = xbmcgui.ListItem('Ironman')
listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
xbmc.Player().play(url, listitem, windowed)
xbmc.Player().play(playlist, listitem, windowed, startpos)
...
stop() None[source]

Stop playing.

pause() None[source]

Pause or resume playing if already paused.

playnext() None[source]

Play next item in playlist.

playprevious() None[source]

Play previous item in playlist.

playselected(selected: int) None[source]

Play a certain item from the current playlist.

Parameters:

selected – Integer - Item to select

isPlaying() bool[source]

Check Kodi is playing something.

Returns:

True if Kodi is playing a file.

isPlayingAudio() bool[source]

Check for playing audio.

Returns:

True if Kodi is playing an audio file.

isPlayingVideo() bool[source]

Check for playing video.

Returns:

True if Kodi is playing a video.

isPlayingRDS() bool[source]

Check for playing radio data system (RDS).

Returns:

True if kodi is playing a radio data system (RDS).

isExternalPlayer() bool[source]

Check for external player.

Returns:

True if kodi is playing using an external player.

@python_v18 New function added.

getPlayingFile() str[source]

Returns the current playing file as a string.

Note

For LiveTV, returns a pvr:// url which is not translatable to an OS specific file or external url.

Returns:

Playing filename

Raises:

Exception – If player is not playing a file.

getPlayingItem() xbmcgui.ListItem[source]

Returns the current playing item.

Returns:

Playing item

Raises:

Exception – If player is not playing a file.

@python_v20 New function added.

getTime() float[source]

Get playing time.

Returns the current time of the current playing media as fractional seconds.

Returns:

Current time as fractional seconds

Raises:

Exception – If player is not playing a file.

seekTime(seekTime: float) None[source]

Seek time.

Seeks the specified amount of time as fractional seconds. The time specified is relative to the beginning of the currently. playing media file.

Parameters:

seekTime – Time to seek as fractional seconds

Raises:

Exception – If player is not playing a file.

setSubtitles(subtitleFile: str) None[source]

Set subtitle file and enable subtitles.

Parameters:

subtitleFile – File to use as source ofsubtitles

showSubtitles(bVisible: bool) None[source]

Enable / disable subtitles.

Parameters:

visible – [boolean] True for visible subtitles.

Example:

...
xbmc.Player().showSubtitles(True)
...
getSubtitles() str[source]

Get subtitle stream name.

Returns:

Stream name

getAvailableSubtitleStreams() List[str][source]

Get Subtitle stream names.

Returns:

List of subtitle streams as name

setSubtitleStream(iStream: int) None[source]

Set Subtitle Stream.

Parameters:

iStream – [int] Subtitle stream to select for play

Example:

...
xbmc.Player().setSubtitleStream(1)
...
updateInfoTag(item: xbmcgui.ListItem) None[source]

Update info labels for currently playing item.

Parameters:

item – ListItem with new info

Raises:

Exception – If player is not playing a file

@python_v18 New function added.

Example:

...
item = xbmcgui.ListItem()
item.setPath(xbmc.Player().getPlayingFile())
item.setInfo('music', {'title' : 'foo', 'artist' : 'bar'})
xbmc.Player().updateInfoTag(item)
...
getVideoInfoTag() InfoTagVideo[source]

To get video info tag.

Returns the VideoInfoTag of the current playing Movie.

Returns:

Video info tag

Raises:

Exception – If player is not playing a file or current file is not a movie file.

getMusicInfoTag() InfoTagMusic[source]

To get music info tag.

Returns the MusicInfoTag of the current playing ‘Song’.

Returns:

Music info tag

Raises:

Exception – If player is not playing a file or current file is not a music file.

getRadioRDSInfoTag() InfoTagRadioRDS[source]

To get Radio RDS info tag

Returns the RadioRDSInfoTag of the current playing ‘Radio Song if. present’.

Returns:

Radio RDS info tag

Raises:

Exception – If player is not playing a file or current file is not a rds file.

getTotalTime() float[source]

To get total playing time.

Returns the total time of the current playing media in seconds. This is only accurate to the full second.

Returns:

Total time of the current playing media

Raises:

Exception – If player is not playing a file.

getAvailableAudioStreams() List[str][source]

Get Audio stream names

Returns:

List of audio streams as name

setAudioStream(iStream: int) None[source]

Set Audio Stream.

Parameters:

iStream – [int] Audio stream to select for play

Example:

...
xbmc.Player().setAudioStream(1)
...
getAvailableVideoStreams() List[str][source]

Get Video stream names

Returns:

List of video streams as name

setVideoStream(iStream: int) None[source]

Set Video Stream.

Parameters:

iStream – [int] Video stream to select for play

Example:

...
xbmc.Player().setVideoStream(1)
...
onPlayBackStarted() None[source]

onPlayBackStarted method.

Will be called when Kodi player starts. Video or audio might not be available at this point.

@python_v18 Use onAVStarted() instead if you need to detect if Kodi is actually playing a media file (i.e, if a stream is available)

onAVStarted() None[source]

onAVStarted method.

Will be called when Kodi has a video or audiostream.

@python_v18 New function added.

onAVChange() None[source]

onAVChange method.

Will be called when Kodi has a video, audio or subtitle stream. Also happens when the stream changes.

@python_v18 New function added.

onPlayBackEnded() None[source]

onPlayBackEnded method.

Will be called when Kodi stops playing a file.

onPlayBackStopped() None[source]

onPlayBackStopped method.

Will be called when user stops Kodi playing a file.

onPlayBackError() None[source]

onPlayBackError method.

Will be called when playback stops due to an error.

onPlayBackPaused() None[source]

onPlayBackPaused method.

Will be called when user pauses a playing file.

onPlayBackResumed() None[source]

onPlayBackResumed method.

Will be called when user resumes a paused file.

onQueueNextItem() None[source]

onQueueNextItem method.

Will be called when user queues the next item.

onPlayBackSpeedChanged(speed: int) None[source]

onPlayBackSpeedChanged method.

Will be called when players speed changes (eg. user FF/RW).

Parameters:

speed – [integer] Current speed of player

Note

Negative speed means player is rewinding, 1 is normal playback speed.

onPlayBackSeek(time: int, seekOffset: int) None[source]

onPlayBackSeek method.

Will be called when user seeks to a time.

Parameters:
  • time – [integer] Time to seek to

  • seekOffset – [integer] ?

onPlayBackSeekChapter(chapter: int) None[source]

onPlayBackSeekChapter method.

Will be called when user performs a chapter seek.

Parameters:

chapter – [integer] Chapter to seek to

class xbmc.PlayList(playList: int)[source]

Bases: object

Kodi’s Play `List` class.

To create and edit a playlist which can be handled by the player.

Parameters:

playList – [integer] To define the stream type

Value

Integer String

Description

0

xbmc.PLAYLIST_MUSIC

Playlist for music files or streams

1

xbmc.PLAYLIST_VIDEO

Playlist for video files or streams

Example:

...
play=xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
...
getPlayListId() int[source]

Get the PlayList Identifier

Returns:

Id as an integer.

add(url: str, listitem: xbmcgui.ListItem | None = None, index: int = -1) None[source]

Adds a new file to the playlist.

Parameters:
  • url – string or unicode - filename or url to add.

  • listitem – [opt] listitem - used with setInfo() to set different infolabels.

  • index – [opt] integer - position to add playlist item. (default=end)

Note

You can use the above as keywords for arguments and skip certain optional arguments. Once you use a keyword, all following arguments require the keyword.

Example:

..
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
video = 'F:\movies\Ironman.mov'
listitem = xbmcgui.ListItem('Ironman', thumbnailImage='F:\movies\Ironman.tbn')
listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
playlist.add(url=video, listitem=listitem, index=7)
..
load(filename: str) bool[source]

Load a playlist.

Clear current playlist and copy items from the file to this Playlist filename can be like .pls or .m3u …

Parameters:

filename – File with list to play inside

Returns:

False if unable to load playlist

remove(filename: str) None[source]

Remove an item with this filename from the playlist.

Parameters:

filename – The file to remove from list.

clear() None[source]

Clear all items in the playlist.

size() int[source]

Returns the total number of PlayListItems in this playlist.

Returns:

Amount of playlist entries.

shuffle() None[source]

Shuffle the playlist.

unshuffle() None[source]

Unshuffle the playlist.

getposition() int[source]

Returns the position of the current song in this playlist.

Returns:

Position of the current song

class xbmc.RenderCapture[source]

Bases: object

Kodi’s render capture.

getWidth() int[source]

Get width

To get width of captured image as set during RenderCapture.capture(). Returns 0 prior to calling capture.

Returns:

Width or 0 prior to calling capture

getHeight() int[source]

Get height

To get height of captured image as set during RenderCapture.capture(). Returns 0 prior to calling capture.

Returns:

height or 0 prior to calling capture

getAspectRatio() float[source]

Get aspect ratio of currently displayed video.

Returns:

Aspect ratio

This may be called prior to calling RenderCapture.capture().

getImageFormat() str[source]

Get image format

Returns:

Format of captured image: ‘BGRA’

@python_v17 Image will now always be returned in BGRA

getImage(msecs: int = 0) bytearray[source]

Returns captured image as a bytearray.

Parameters:

msecs – [opt] Milliseconds to wait. Waits 1000ms if not specified

Returns:

Captured image as a bytearray

Note

The size of the image is m_width * m_height * 4

@python_v17 Added the option to specify wait time in msec.

capture(width: int, height: int) None[source]

Issue capture request.

Parameters:
  • width – Width capture image should be rendered to

  • height – Height capture image should should be rendered to

@python_v17 Removed the option to pass flags

xbmc.log(msg: str, level: int = 0) None[source]

Write a string to Kodi’s log file and the debug window.

Parameters:
  • msg – string - text to output.

  • level – [opt] integer - log level to output at.(default=LOGDEBUG)

Value:

Description:

xbmc.LOGDEBUG

In depth information about the status of Kodi. This information can pretty much only be deciphered by a developer or long time Kodi power user.

xbmc.LOGINFO

Something has happened. It’s not a problem, we just thought you might want to know. Fairly excessive output that most people won’t care about.

xbmc.LOGWARNING

Something potentially bad has happened. If Kodi did something you didn’t expect, this is probably why. Watch for errors to follow.

xbmc.LOGERROR

This event is bad. Something has failed. You likely noticed problems with the application be it skin artifacts, failure of playback a crash, etc.

xbmc.LOGFATAL

We’re screwed. Kodi is about to crash.

Note

Addon developers are advised to keep LOGDEBUG as the default logging level and to use conservative logging (log only if needed). Excessive logging makes it harder to debug kodi itself.

Logging in kodi has a global configuration level that controls how text is written to the log. This global logging behaviour can be changed in the GUI (Settings -> System -> Logging) (debug toggle) or furthered configured in advancedsettings (loglevel setting).

Text is written to the log for the following conditions:

  • loglevel == -1 (NONE, nothing at all is logged to the log)

  • loglevel == 0 (NORMAL, shows LOGINFO,``LOGWARNING``,``LOGERROR`` and LOGFATAL) - Default kodi behaviour

  • loglevel == 1 (DEBUG, shows all) - Behaviour if you toggle debug log in the GUI

@python_v17 Default level changed from LOGNOTICE to LOGDEBUG

@python_v19 Removed LOGNOTICE (use LOGINFO) and LOGSEVERE (use LOGFATAL)

Example:

..
xbmc.log(msg='This is a test string.', level=xbmc.LOGDEBUG);
..
xbmc.shutdown() None[source]

Shutdown the htpc.

Example:

..
xbmc.shutdown()
..
xbmc.restart() None[source]

Restart the htpc.

Example:

..
xbmc.restart()
..
xbmc.executescript(script: str) None[source]

Execute a python script.

Parameters:

script – string - script filename to execute.

Example:

..
xbmc.executescript('special://home/scripts/update.py')
..
xbmc.executebuiltin(function: str, wait: bool = False) None[source]

Execute a built in Kodi function.

Parameters:
  • function – string - builtin function to execute.

  • wait – [opt] bool - If Kodi should wait for the builtin function execution to finish (default False)

List of builtin functions: https://kodi.wiki/view/List_of_built-in_functions

Example:

..
xbmc.executebuiltin('Skin.SetString(abc,def)')
..
xbmc.executeJSONRPC(jsonrpccommand: str) str[source]

Execute an JSONRPC command.

Parameters:

jsonrpccommand – string - jsonrpc command to execute.

Returns:

jsonrpc return string

Example:

..
response = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "JSONRPC.Introspect", "id": 1 }')
..
xbmc.sleep(timemillis: int) None[source]

Sleeps for ‘time’ (msec).

Parameters:

time – integer - number of msec to sleep.

Raises:

TypeError – If time is not an integer.

This is useful if you need to sleep for a small amount of time (milisecond range) somewhere in your addon logic. Please note that Kodi will attempt to stop any running scripts when signaled to exit and wait for a maximum of 5 seconds before trying to force stop your script. If your addon makes use of xbmc.sleep() incorrectly (long periods of time, e.g. that exceed the force stop waiting time) it may lead to Kodi hanging on shutdown. In case your addon needs long sleep/idle periods use xbmc.Monitor().waitForAbort(secs) instead.

Example:

..
xbmc.sleep(2000) # sleeps for 2 seconds
..
xbmc.getLocalizedString(id: int) str[source]

Get a localized ‘unicode string’.

Parameters:

id – integer - id# for string you want to localize.

Returns:

Localized ‘unicode string’

Note

See strings.po in``language{yourlanguage}`` for which id you need for a string.

Example:

..
locstr = xbmc.getLocalizedString(6)
..
xbmc.getSkinDir() str[source]

Get the active skin directory.

Returns:

The active skin directory as a string

Note

This is not the full path like ‘special://home/addons/MediaCenter’, but only ‘MediaCenter’.

Example:

..
skindir = xbmc.getSkinDir()
..
xbmc.getLanguage(format: int = 2, region: bool = False) str[source]

Get the active language.

Parameters:

format – [opt] format of the returned language string

Value

Description

xbmc.ISO_639_1

Two letter code as defined in ISO 639-1

xbmc.ISO_639_2

Three letter code as defined in ISO 639-2/T or ISO 639-2/B

xbmc.ENGLISH_NAME

Full language name in English (default)

Parameters:

region – [opt] append the region delimited by “-” of the language (setting) to the returned language string

Returns:

The active language as a string

@python_v13 Added new options format and region.

Example:

..
language = xbmc.getLanguage(xbmc.ENGLISH_NAME)
..
xbmc.getIPAddress() str[source]

Get the current ip address.

Returns:

The current ip address as a string

Example:

..
ip = xbmc.getIPAddress()
..
xbmc.getDVDState() int[source]

Returns the dvd state as an integer.

Returns:

Values for state are:

Value

Name

1

xbmc.DRIVE_NOT_READY

16

xbmc.TRAY_OPEN

64

xbmc.TRAY_CLOSED_NO_MEDIA

96

xbmc.TRAY_CLOSED_MEDIA_PRESENT

Example:

..
dvdstate = xbmc.getDVDState()
..
xbmc.getFreeMem() int[source]

Get amount of free memory in MB.

Returns:

The amount of free memory in MB as an integer

Example:

..
freemem = xbmc.getFreeMem()
..
xbmc.getInfoLabel(cLine: str) str[source]

Get a info label

Parameters:

infotag – string - infoTag for value you want returned.

Returns:

InfoLabel as a string

List of InfoLabels: https://kodi.wiki/view/InfoLabels

Example:

..
label = xbmc.getInfoLabel('Weather.Conditions')
..
xbmc.getInfoImage(infotag: str) str[source]

Get filename including path to the InfoImage’s thumbnail.

Parameters:

infotag – string - infotag for value you want returned

Returns:

Filename including path to the InfoImage’s thumbnail as a string

List of InfoTags: http://kodi.wiki/view/InfoLabels

Example:

..
filename = xbmc.getInfoImage('Weather.Conditions')
..
xbmc.playSFX(filename: str, useCached: bool = True) None[source]

Plays a wav file by filename

Parameters:
  • filename – string - filename of the wav file to play

  • useCached – [opt] bool - False = Dump any previously cached wav associated with filename

@python_v14 Added new option useCached.

Example:

..
xbmc.playSFX('special://xbmc/scripts/dingdong.wav')
xbmc.playSFX('special://xbmc/scripts/dingdong.wav',False)
..
xbmc.stopSFX() None[source]

Stops wav file

@python_v14 New function added.

Example:

..
xbmc.stopSFX()
..
xbmc.enableNavSounds(yesNo: bool) None[source]

Enables/Disables nav sounds

Parameters:

yesNo – bool - enable (True) or disable (False) nav sounds

Example:

..
xbmc.enableNavSounds(True)
..
xbmc.getCondVisibility(condition: str) bool[source]

Get visibility conditions

Parameters:

condition – string - condition to check

Returns:

True (if the condition is verified) or False (otherwise)

List of boolean conditions: https://kodi.wiki/view/List_of_boolean_conditions

Note

You can combine two (or more) of the above settings by using + as an AND operator, | as an OR operator, ! as a NOT operator, and [ and ] to bracket expressions.

Example:

..
visible = xbmc.getCondVisibility('[Control.IsVisible(41) + !Control.IsVisible(12)]')
..
xbmc.getGlobalIdleTime() int[source]

Get the elapsed idle time in seconds.

Returns:

Elapsed idle time in seconds as an integer

Example:

..
t = xbmc.getGlobalIdleTime()
..
xbmc.getCacheThumbName(path: str) str[source]

Get thumb cache filename.

Parameters:

path – string - path to file

Returns:

Thumb cache filename

Example:

..
thumb = xbmc.getCacheThumbName('f:\videos\movie.avi')
..
xbmc.getCleanMovieTitle(path: str, usefoldername: bool = False) Tuple[str, str][source]

Get clean movie title and year string if available.

Parameters:
  • path – string - String to clean

  • usefoldername – [opt] bool - use folder names (defaults to false)

Returns:

Clean movie title and year string if available.

Example:

..
title, year = xbmc.getCleanMovieTitle('/path/to/moviefolder/test.avi', True)
..
xbmc.getRegion(id: str) str[source]

Returns your regions setting as a string for the specified id.

Parameters:

id – string - id of setting to return

Returns:

Region setting

Note

choices are (dateshort, datelong, time, meridiem, tempunit, speedunit)

Example:

..
date_long_format = xbmc.getRegion('datelong')
..
xbmc.getSupportedMedia(mediaType: str) str[source]

Get the supported file types for the specific media.

Parameters:

media – string - media type

Returns:

Supported file types for the specific media as a string

Note

Media type can be (video, music, picture). The return value is a pipe separated string of filetypes (eg. '.mov |.avi').

Example:

..
mTypes = xbmc.getSupportedMedia('video')
..
xbmc.skinHasImage(image: str) bool[source]

Check skin for presence of Image.

Parameters:

image – string - image filename

Returns:

True if the image file exists in the skin

Note

If the media resides in a subfolder include it. (eg. home-myfileshome-myfiles2.png).

Example:

..
exists = xbmc.skinHasImage('ButtonFocusedTexture.png')
..
xbmc.startServer(iTyp: int, bStart: bool) bool[source]

Start or stop a server.

Parameters:

typ – integer - use SERVER_* constants Used format of the returned language string

Value

Description

xbmc.SERVER_WEBSERVER

To control Kodi’s builtin webserver

xbmc.SERVER_AIRPLAYSERVER

AirPlay is a proprietary protocol stack/suite developed by Apple Inc.

xbmc.SERVER_JSONRPCSERVER

Control JSON-RPC HTTP/TCP socket-based interface

xbmc.SERVER_UPNPRENDERER

UPnP client (aka UPnP renderer)

xbmc.SERVER_UPNPSERVER

Control built-in UPnP A/V media server (UPnP-server)

xbmc.SERVER_EVENTSERVER

Set eventServer part that accepts remote device input on all platforms

xbmc.SERVER_ZEROCONF

Control Kodi’s Avahi Zeroconf

Parameters:

bStart – bool - start (True) or stop (False) a server

Returns:

bool - True or False

@python_v20 Removed option bWait.

Example:

..
xbmc.startServer(xbmc.SERVER_AIRPLAYSERVER, False)
..
xbmc.audioSuspend() None[source]

Suspend Audio engine.

Example:

..
xbmc.audioSuspend()
..
xbmc.audioResume() None[source]

Resume Audio engine.

Example:

..
xbmc.audioResume()
..
xbmc.getUserAgent() str[source]

Returns Kodi’s HTTP UserAgent string

Returns:

HTTP user agent

Example:

..
xbmc.getUserAgent()
..

example output: Kodi/17.0-ALPHA1 (X11; Linux x86_64) Ubuntu/15.10 App_Bitness/64 Version/17.0-ALPHA1-Git:2015-12-23-5770d28

xbmc.convertLanguage(language: str, format: int) str[source]

Returns the given language converted to the given format as a string.

Parameters:
  • language – string either as name in English, two letter code (ISO 639-1), or three letter code (ISO 639-2/T(B)

  • format – format of the returned language string

Value

Description

xbmc.ISO_639_1

Two letter code as defined in ISO 639-1

xbmc.ISO_639_2

Three letter code as defined in ISO 639-2/T or ISO 639-2/B

xbmc.ENGLISH_NAME

Full language name in English (default)

Returns:

Converted Language string

@python_v13 New function added.

Example:

..
language = xbmc.convertLanguage(English, xbmc.ISO_639_2)
..