Skip to content

Skin Tools and Helpers

jurialmunkey edited this page Sep 27, 2023 · 18 revisions

Search Term History (Script)

SkinVariables allows for storing a history of search terms in a Skin.String or Window.Property

Add Search Term

RunScript(script.skinvariables,add_skinstring_history=SKINSTRING,value=SEARCHTERM)

Replace SKINSTRING with the name of the Skin.String(SKINSTRING) to be used.
Replace SEARCHTERM with the value to put into the search history.

If a term already exists in the history, it is moved to the first position.

Optional Params

Param Description
use_window_prop Use a Window.Property() instead of a Skin.String().
Useful if you do not want the search history to persist after closing Kodi.
window_id=ID Specify the ID of the Window(ID).Property() when use_window_prop is enabled.
By default the current window will be used.
toggle Remove the search term if it exists instead of moving to first position.
Useful to create menus where multiple terms are toggled.
separator=' / ' Specify the separator to be used for the search history.
By default a pipe | character is used to avoid conflicts with Kodi's default / slash character

📚 To retrieve the search history in a container list, see the string splitter method below.

String Splitter (Container)

Splits a string into a list of ListItems where ListItem.Label contains the split term. The infolabel= can be any infolabel that would go inside $INFO[]

plugin://script.skinvariables/?info=get_split_string&infolabel=Skin.String(SKINSTRING)

Optional Params

Param Description
&separator=' / ' Specify a different separator than the default | pipe symbol.
Useful if you want to split an infolabel from a listitem such as ListItem.Genre
&values=TEXT Alternative to infolabel= if you want to specify text directly.
Useful if you want to use $VAR[] instead of an infolabel.

💡 Example: Split Genres into a List

plugin://script.skinvariables/?info=get_split_string&infolabel=ListItem.Genre&separator=' / '

Get List of Container ListItem Infolabels (Container)

Gets all unique values for the specified container IDs as a List of ListItems. Multiple container IDs can be specified by separating with a +

plugin://script.skinvariables/?info=get_container_labels&containers=CONTAINERID&infolabel=INFOLABEL

💡 Example: List all studios for all items in containers 5001 and 5002

plugin://script.skinvariables/?info=get_container_labels&containers=5001+5002&infolabel=ListItem.Studio

📚 Optionally the container can also be filtered using filter_value and exclude_value params. Useful if you want to provide an edit control to narrow down results.

Set Player Subtitle/Audio Stream (Script)

Sets the audio or subtitle stream for the currently playing video to X where X is the number of the stream.

Runscript(set_player_subtitle=X)
Runscript(set_player_audiostream=X)

Get Player Subtitle/Audio Streams (Container)

Gets a list of subtitles or audio streams for the currently playing video.

plugin://script.skinvariables/?info=get_player_streams&stream_type=subtitle
plugin://script.skinvariables/?info=get_player_streams&stream_type=audio

Set Edit Control (Script)

Inputs the TEXT into the edit control at EDITID and then returns focus to RETURNID after the specified wait. The setfocus params are optional and can be removed if you want focus to stay on the edit control.

RunScript(script.skinvariables,set_editcontrol=EDITID,text=TEXT,setfocus=RETURNID,setfocus_wait=00:00)

Set Tag to DBID (Script)

RunScript(script.skinvariables,set_dbid_tag=TAGNAME,dbtype=DBTYPE,dbid=DBID)

Create a tag called TAGNAME for the library item of the specified DBID and DBTYPE. Only works for dbtype=movie and dbtype=tvshow

Get Number Sum (Container)

Adds the specified numbers together and outputs to ListItem.Label

plugin://script.skinvariables/?info=get_number_sum&expression=5+12+7

💡 Example: Sum of Container(5001).NumItems and Container(5002).NumItems

plugin://script.skinvariables/?info=get_number_sum&expression=0$INFO[Container(5001).NumItems,+,]$INFO[Container(5002).NumItems,+,]

📚 To subtract numbers use +- to add a negative number.
💡 Example: Subtract Container(5002).NumItems from Container(5001).NumItems

plugin://script.skinvariables/?info=get_number_sum&expression=0$INFO[Container(5001).NumItems,+,]$INFO[Container(5002).NumItems,+-,]

Get Encoded String (Container)

Encodes the string using urlquote_plus routine and optionally saves to window property.

<content>plugin://script.skinvariables/?info=get_encoded_string&amp;window_prop=MyEncodedString&amp;window_id=Home&amp;&amp;Umläuts,‡†Special Characters</content>

📚 Use RunPlugin if onclick is preferred

<onclick>RunPlugin("plugin://script.skinvariables/?info=get_encoded_string&amp;window_prop=MyEncodedString&amp;window_id=Home&amp;&amp;Umläuts,‡†Special Characters")</onclick>

Multiple strings can be specified using double ampersand &amp;&amp;
Each string is added to its own listitem and window property:

$INFO[Container(ID).ListItemAbsolute(0).Label]
$INFO[Container(ID).ListItemAbsolute(1).Label]
$INFO[Window(WINDOW_ID).Property(WINDOW_PROP.0)]
$INFO[Window(WINDOW_ID).Property(WINDOW_PROP.1)]

Get DBTYPE Details (Container)

Retrieve additional details about an item from the library via JSON RPC. Values are stored in Container(ID).ListItem.Property(PROPERTYNAME)

plugin://script.skinvariables/?info=get_dbitem_movieset_details&amp;dbid=DBID
plugin://script.skinvariables/?info=get_dbitem_movie_details&amp;dbid=DBID
plugin://script.skinvariables/?info=get_dbitem_tvshow_details&amp;dbid=DBID
plugin://script.skinvariables/?info=get_dbitem_season_details&amp;dbid=DBID
plugin://script.skinvariables/?info=get_dbitem_episode_details&amp;dbid=DBID
plugin://script.skinvariables/?info=get_dbitem_addon_details&amp;dbid=DBID

💡 Example: Get more details about a Movie

plugin://script.skinvariables/?info=get_dbitem_movie_details&amp;dbid=$INFO[Container(50).ListItem.DBID]

📚 Details retrieved for each dbtype

DBType Details
movie title plot genre director writer studio cast country fanart thumbnail tag art ratings
tvshow title plot genre studio cast fanart thumbnail tag art ratings runtime
season title plot fanart thumbnail tvshowid art
episode title plot writer director cast fanart thumbnail tvshowid art seasonid ratings
set title plot playcount fanart thumbnail art
addon name version summary description path author thumbnail disclaimer fanart dependencies broken extrainfo rating enabled installed deprecated

📚 Details are placed in properties

$INFO[Container(ID).ListItem.Property(plot)]
$INFO[Container(ID).ListItem.Property(title)]

📚 Details with child attributes are referenced with a dot separator:

$INFO[Container(ID).ListItem.Property(art.poster)]
$INFO[Container(ID).ListItem.Property(ratings.imdb.rating)]
$INFO[Container(ID).ListItem.Property(ratings.imdb.votes)]

📚 Details which can have multiple values are referenced by index:

$INFO[Container(ID).ListItem.Property(genre.0)]
$INFO[Container(ID).ListItem.Property(genre.1)]
$INFO[Container(ID).ListItem.Property(genre.count)]
$INFO[Container(ID).ListItem.Property(director.0)]
$INFO[Container(ID).ListItem.Property(director.1)]
$INFO[Container(ID).ListItem.Property(director.count)]

📚 Details which can have multiple values with child attributes are referenced by index and dot notation:

$INFO[Container(ID).ListItem.Property(cast.0.name)]
$INFO[Container(ID).ListItem.Property(cast.0.role)]
$INFO[Container(ID).ListItem.Property(cast.0.thumbnail)]
$INFO[Container(ID).ListItem.Property(cast.1.name)]
$INFO[Container(ID).ListItem.Property(cast.1.role)]
$INFO[Container(ID).ListItem.Property(cast.1.thumbnail)]
$INFO[Container(ID).ListItem.Property(cast.count)]

📚 Sets also retrieve subdetails about each movieid inside the set

$INFO[Container(ID).ListItem.Property(movies.count)]
$INFO[Container(ID).ListItem.Property(movies.1.label)]
$INFO[Container(ID).ListItem.Property(movies.1.item.plot)]
$INFO[Container(ID).ListItem.Property(movies.1.item.art.fanart)]
$INFO[Container(ID).ListItem.Property(movies.1.item.ratings.imdb.rating)]
$INFO[Container(ID).ListItem.Property(movies.1.item.genre.0)]
$INFO[Container(ID).ListItem.Property(movies.1.item.cast.0.name)]

Clone this wiki locally