Artwork/Accessing with skins and JSON-RPC

From Official Kodi Wiki
Jump to navigation Jump to search
Home icon grey.png   ▶ Development ▶ Artwork ▶ Accessing with skins and JSON-RPC

Artwork can be accessed by name in skins and over JSON-RPC. Media items with a "parent" media type, such as episodes to their TV show, can also access their parent's artwork with certain prefixes, like "tvshow.poster".

From skins

Skins can access library artwork for media items in a list with "ListItem.Art(<arttype>)" and artwork for the currently playing item with "Player.Art(<arttype>)". "Container.Art(<arttype>)" can also be filled in some instances. Some examples are

​Player.Art(poster)​

,

​Player.Art(fanart)​

,

​ListItem.Art(banner)​

, and

​ListItem.Art(tvshow.clearlogo)​

.

From JSON-RPC

Several JSON-RPC methods (like "VideoLibrary.GetMovies", "AudioLibrary.GetAlbumDetails", and "Playlist.GetItems") return info for media items in the library, and requesting the "art" property will return an "art" dictionary that maps all available artwork for the media item. The key is the artwork type and the value is a specially-encoded URL or path to the assigned artwork.

Example

example request:

{"jsonrpc":"2.0","id":11,"method":"VideoLibrary.GetEpisodes","params":{"properties":["art"],"limits":{"end":1},"sort":{"method":"random"}}}

and a possible response:

{
    "id": 11,
    "jsonrpc": "2.0",
    "result": {
        "episodes": [
           {
                "art": {
                    "season.banner": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fseason02-banner.jpg/",
                    "season.landscape": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fseason02-landscape.jpg/",
                    "season.poster": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fseason02-poster.jpg/",
                    "thumb": "image://video@nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fV%20(2009)%20-%2002x05%20-%20Concordia%20-%20720p%20WEB-DL.mkv/",
                    "tvshow.banner": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fbanner.jpg/",
                    "tvshow.clearlogo": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fclearlogo.png/",
                    "tvshow.fanart": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2ffanart.jpg/",
                    "tvshow.poster": "image://nfs%3a%2f%2fCUBER%2fmedia%2fpreserved%2fTVShows%2fV%20(2009)%2fposter.jpg/"
                },
                "episodeid": 2196,
                "label": "2x05. Concordia"
            }
        ],
        "limits": {
            "end": 1,
            "start": 0,
            "total": 3352
        }
    }
}

specially-encoded URL

The image paths returned by JSON-RPC are the path or URL to the image encoded as Kodi's internal "image://" path.

To turn that path into a URL that can actually be displayed in another application, you will need to encode it as a URI component (examples are encodeURIComponent in JS and urllib.parse.quote in Python 3), then add that to the end of the "images/" path of the Kodi HTTP server (like http://kodihost:8080/images/). With these URLs you can display images wherever they happen to be stored; Kodi will handle opening a file over SMB or NFS if they are stored on a NAS next to the media items, for instance.

The final URL will look like 

http://kodihost:8080/images/image%3A%2F%2Fnfs%253a%252f%252fCUBER%252fmedia%252fpreserved%252fTVShows%252fV%2520(2009)%252fposter.jpg%2F

You can also turn the "image://" URL into a more traditional looking path/URL (https:// or smb:// or H:\) by chopping off the "image://" up front and the slash at the end, then decoding the rest as a URI component.

Access "parent" artwork

For several media types, it is possible to access artwork for the "parent" media item as well as the item's own artwork. This works for skins and JSON-RPC. For instance, TV episodes can access the artwork for the containing season and TV show. Use "<parenttype>.<arttype>" as the art type.

Media types and their parent types
Media type Parent type Description Skin examples
TV episodes "season", "tvshow" TV episodes can access artwork for their containing season and TV show "Player.Art(tvshow.clearlogo)", "Player.Art(season.poster)"
Seasons "tvshow" TV show artwork "ListItem.Art(tvshow.banner)", "ListItem.Art(tvshow.clearlogo)"
Movies "set" In Kodi 18, movies can access artwork for their containing set / collection "ListItem.Art(set.clearlogo)", "ListItem.Art(set.poster)"
Songs "album", "artist", "albumartist", "artist1", "albumartist1" Songs can access the artwork for their containing album and all artists. Songs can have multiple artists; in Kodi 18 "artist1" will be artwork for the second artist - "artist2", "artist3", and so on will be filled for additional artists. "albumartist" works the same for album artists. "Player.Art(album.thumb)", "Player.Art(artist.fanart)", "Player.Art(albumartist.clearlogo)", "Player.Art(artist1.fanart)"
Albums "artist", "artist1" Albums can access the artwork for their containing album. Albums can have multiple artists; in Kodi 18 "artist1" will be artwork for the second artist - "artist2", "artist3", and so on will be filled for additional artists. "ListItem.Art(artist.fanart)", "ListItem.Art(artist.clearlogo)"

Example artwork types

Here is a short list of example artwork types and how to access them. Kodi's artwork system allows any number of artwork types, so it's impossible to list all that may be available here. See the artwork pages for different library sections like Movie artwork or Music artwork for a list of generally available artwork types, or navigate to image 2 of Artwork#Kodi- Choose Art on a media item in your local Kodi installation to see what types of artwork are currently available for at least one of that media type in your local library.

Example artwork types and skin access
Artwork type Skin InfoLabel Description
poster ListItem.Art(poster) Poster of the currently focused media item (like a movie or TV show)
fanart ListItem.Art(fanart) Fanart of the currently focused media item
landscape ListItem.Art(landscape) Landscape of the currently focused media item
clearlogo Player.Art(clearlogo) Clearlogo of the currently playing media item
tvshow.poster Player.Art(tvshow.poster) For a currently playing TV episode, this is the poster of the parent TV show
set.poster Player.Art(set.clearlogo) For currently playing movies, this is the clearlogo of the containing movie set
album.thumb Player.Art(album.thumb) For currently playing music, this is the cover of the album


Return to top