Tools - kodi-community-addons/script.skin.helper.service GitHub Wiki

Tools and actions provided by the script

The script provides several tools and actions which you can use in your skin.


Music library search

RunScript(script.skin.helper.service,action=musicsearch)

This command will open the default search window for the music library. Might come in handy if you want to create a shortcut to music search from outside the music library window.


Video library search (extended)

RunScript(script.skin.helper.service,action=videosearch)

This command will open the special search window in the script. It has an onscreen keyboard to quickly search for movies, tvshows and episodes. You can customize the look and feel of this search dialog. To do that include the files script-skin_helper_service-CustomSearch.xml in your skin and skin it to your needs.


Special Info Dialog

RunScript(script.skin.helper.service,action=showinfo)

The script contains a workaround to use the DialogVideoInfo.xml from everywhere (e.g. from widgets). This special info dialog is also used by the Special search dialog (see above). As of Kodi Krypton (v17) this workaround is no longer needed as this functionality is available in Kodi natively.


Yes/No Dialog (dialogYesNo)

RunScript(script.skin.helper.service,action=dialogyesno,header=[yourheadertext],message=[your message body],yesaction=[action for yes],noaction=[optional action for no])

This command will open Kodi's YesNo dialog with the text you supplied. If the user presses YES, the action will be executed you supplied. To provide multiple actions, seperate by | You can use any Kodi permitted action. If you also want to specify action(s when the user presses NO, also supplu the NOACTION argument.


Message Dialog (dialogOK)

RunScript(script.skin.helper.service,action=dialogok,header=[yourheadertext],message=[your message body])

This command will open Kodi's dialog OK window with the text you supplied


Message Dialog (textviewer)

RunScript(script.skin.helper.service,action=textviewer,header=[yourheadertext],message=[your message body])

This command will open Kodi's TextViewer window with the text you supplied.


Youtube search

Shows a selectdialog with all searchresults found by the Youtube plugin, for example to search for trailers in DialogVideoInfo.xml. The benefit of that is that user stays in the same window and is not moved away from the library to the youtube plugin. You can supply a searchphrase to the script and optionally provide a label for the header in the DialogSelect.

RunScript(script.skin.helper.service,action=searchyoutube,title=[SEARCHPHRASE],header=[HEADER FOR THE DIALOGSELECT])

TIP: The results of the script displayed in DialogSelect.xml will have the label2 of the ListItem set to the description.

example 1: Search for trailers in DialogVideoInfo.xml

<control type="button">
	<label>YouTube $LOCALIZE[20410]</label>
	<onclick condition="System.HasAddon(plugin.video.youtube)">RunScript(script.skin.helper.service,action=searchyoutube,title=$INFO[ListItem.Title] Trailer,header=Search YouTube Trailers)</onclick>
	<onclick condition="!System.HasAddon(plugin.video.youtube)">ActivateWindow(Videos,plugin://plugin.video.youtube)</onclick>
	<visible>Container.Content(movies)</visible>
</control>
           

example 2: Search for artist videos in DialogAlbumInfo.xml

RunScript(script.skin.helper.service,action=searchyoutube,title=$INFO[ListItem.Artist], header=Videos for $INFO[ListItem.Artist])            

Busy spinner selector

Allows the user to select a busy spinner from some predefined ones in your skin. It supports both multiimage (folder with images and single image (.gif spinners. The user can provide his own texture(s or select from predefined spinners in the skin.

RunScript(script.skin.helper.service,action=busytexture)             

The script fills this Skin Strings after selection: SkinHelper.SpinnerTexture.label --> the name of the selected busy texture SkinHelper.SpinnerTexture.Path --> The full path of the selected busy texture

#####To provide busy spinners with your skin:

  • Make sure to create a directory "busy_spinners" in your skin's extras folder.
  • Inside that directory you can put subdirectories for multimage spinners or just gif files in the root.

Instead of supplying the busyspinners in your skin, the script can also use a Kodi image resource addon (resource.images.busyspinners.*)

#####To use the busy texture Make sure that you use a multiimage control in DialogBusy.xml. Example code:

<control type="multiimage">
	<width>150</width>
	<height>150</height>
	<aspectratio>keep</aspectratio>
	<imagepath>$INFO[Skin.String(SkinHelper.SpinnerTexture.Path)]</imagepath>
	<timeperimage>100</timeperimage>
	<colordiffuse>$INFO[Skin.String(SpinnerTextureColor)]</colordiffuse>
	<fadetime>0</fadetime>
	<visible>Skin.String(SkinHelper.SpinnerTexture.Path)</visible>
</control>

Toggle Kodi setting

Can be used to set/unset a specific Kodi system setting (boolean).

RunScript(script.skin.helper.service,action=togglekodisetting,setting=[NAME OF THE SETTING IN GUISETTINGS])           

You must supply the name of the setting as can be found in guisettings.xml or the Json API

#####Example: Toggle the RSS feed

<!--toggle rss feed-->
<control type="radiobutton" id="123456">
    <label>Show RSS Feed</label>
    <onclick>XBMC.RunScript(script.skin.helper.service,action=togglekodisetting,setting=lookandfeel.enablerssfeeds)</onclick>
    <selected>system.getbool(lookandfeel.enablerssfeeds)</selected>
</control>

Set Kodi setting

Can be used to set a specific Kodi system setting (string/int).

RunScript(script.skin.helper.service,action=setkodisetting,setting=[NAME OF THE SETTING IN GUISETTINGS],value=[VALUE FOR THE SETTING-string])          
RunScript(script.skin.helper.service,action=setkodisetting,setting=[NAME OF THE SETTING IN GUISETTINGS],numvalue=[VALUE FOR THE SETTING-integer])          

You must supply the name of the setting as can be found in guisettings.xml or the Json API and the value.

Example: Set the http proxy port

RunScript(script.skin.helper.service,action=setkodisetting,setting=network.httpproxyport,numvalue=8080)

Save skin image

The Kodi builtin Skin.SetImage( only links to a image on a external location, good enough for most situations. If skin settings are transfered this is a bit inconvenient as the image is lost. The method in this script will save the image that the user selects to the skin's folder in addon_data, that way the image is preserved. Also when a skin backup is made by using this script's backup feature, the image will also be copied.

RunScript(script.skin.helper.service,action=saveskinimage,skinstring=[THE SKIN STRING TO SET],multi=[OPTIONAL: true/false],header=[OPTIONAL: header for select window])            

You must supply the name of the skin string that must be set with the result (path will be stored as special://) Optional you can specify if you allow image folders to be selected (multiimage) or a custom dialog header.


Strip string

Can be used to strip/split a string, the results will be stored to a window property.

RunScript(script.skin.helper.service,action=stripstring,splitchar=[splitter text],string=[your string],output=[your window prop])         

Example:

RunScript(script.skin.helper.service,action=stripstring,splitchar=.,string=$INFO[System.BuildVersion],output=kodiversion_main)

The above command will take the Kodi Buildversion Info string and split it on the "." character. The result is the main Kodi version, e.g. "16" or "17". You can access the result in your skin as a window property, in the above example kodiversion_main: $INFO[kodiversion_main)]

Optional argument: index Used to specify which part to return after splitting the string, start counting at 0| For example:

RunScript(script.skin.helper.service,action=stripstring,splitchar=#,string=this#is#a#test,output=kodiversion_main,index=1) will return "is" in the result

If you want to split on a space, use [SPACE] at stripchar


Check if file exists

RunScript(script.skin.helper.service,action=fileexists,file=[filenamepath],skinstring=[skinstring to store the result],winprop=[windowprop to store the result])

This command will check the filesystem if a particular file exists and will write the results to either a skin string or window property. If the file exists, the result will be written as EXISTS in the property or skinstring, if it doesn't exist, the property/string will be empty.


Get percentage of 2 values

RunScript(script.skin.helper.service,action=getpercentage,count=[count value],total=[total items],skinstring=[skin string to write the result],roundsteps=[optional: round to specific steps])

This command will allow you to get a percentage of 2 numbers. The result is (rounded without decimals written to a skin string. If you want the result to be rounded in blocks (e.g. ), you can provide the optional roundsteps parameter


Splash screen / skin intro

Can be used to easily provide a splash/intro option to your skin. Supports all media files: music, video or photo.

First, set the setting somewhere in your skin settings, for example with this code:

control type="radiobutton">
    <label>Enable splash screen (photo, video or music)</label>
    <onclick condition="!Skin.String(SplashScreen)">Skin.SetFile(SplashScreen)</onclick>
    <onclick condition="Skin.String(SplashScreen)">Skin.Reset(SplashScreen)</onclick>
    <selected>Skin.String(SplashScreen)</selected>
</control>

Secondly you have to adjust your Startup.xml from your skin to support the splash intro:

<onload condition="Skin.String(SplashScreen)">RunScript(script.skin.helper.service,action=splashscreen,file=$INFO[Skin.String(SplashScreen)],duration=5)</onload>
<onload condition="!Skin.String(SplashScreen)">ReplaceWindow($INFO[System.StartupWindow])</onload>         

and you need to add both a videowindow and image control to your startup.xml:

<!-- video control for splash -->
<control type="videowindow">
    <width>100%</width>
    <height>100%</height>
</control>
<!-- image control for splash -->
<control type="image">
    <width>100%</width>
    <height>100%</height>
    <aspectratio>keep</aspectratio>
    <texture background="true">$INFO[SkinHelper.SplashScreen)]</texture>
</control>

Offcourse make sure to remove any other references which replaces the window... The duration parameter is optional, this will set the amount of seconds that an image will be shown as splash, defaults to 5 seconds if ommitted. Music and video files always default to play to the end before closing the splash screen.


Get clean filename

RunScript(script.skin.helper.service,action=getfilename,output=RealFileName)

Some addons (like Emby for example) have a meaningless long plugin path as filename but that path contains the actual filename somewhere in the path. In for example DialogVideoInfo you want to display the file's path but you want to show the actual filename and not that long plugin:// path

If you call this method in the onload of your dialog, the filename will be extracted (if possible) and stored into a window property of your choice.

Parameters:

  • output: the name of the Window (Home) Property to store the outcome

NOTE: If you want to retrieve the actual filename for the currently playing item, use action getplayerfilename



⚠️ **GitHub.com Fallback** ⚠️