Skip to content

Tools for resource addons

Marcel van der Veldt edited this page Nov 21, 2016 · 3 revisions

The script comes with a few helper methods that makes working with Kodi Image Resource Addons a bit easier.


Select Image

RunScript(script.skin.helper.service,action=selectimage,skinstring=defaultbackground,resourceaddon=resource.images.skinbackgrounds        

Helper which lets the user select an image or imagepath from resourceaddons or custom path. Show DialogSelect with all choices including the possibility to manually browse for an image.

Parameters:

  • resourceaddon: the type of resource addon to select images from (e.g. resource.images.skinicons)
  • allowmulti: Allow selection of a path instead of single image (true/false)
  • header: use custom header for the dialog
  • skinstring: The Skin String to store the results to
  • skinshortcutsproperty: If you want to store to skinshortcuts property instead of Skin String (only inside script-skinshortcuts.xml)
  • skinhelperbackgrounds: Include backgrounds provided by Skin Helper Backgrounds in the results (true/false)

The dialog will show all results allowing the user to pick or browse an image.

NOTES:

  1. If you have a setting in the custom settings.xml (see section Skin Settings of this wiki) with the same name as the skinstring, any values you supplied in the skinsettings.xml will also be appended to the result.

  2. The dialog will also include a "Get More" button allowing the user to install more resource addons for the given type.

  3. If one of the images is dynamic ($INFO window property) it will be stored as variable in script-skin_helper_service-includes.xml. the variable will have the name of your skin setting and the skinstring value will be set to VAR. In your skin code you can check if the value contains VAR and use the variable instead.

  4. The value will be saved to both the skinstring itself and to skinstring.path. Also skinstring.label will hold the label of the choosen value.


Select Resource addon

RunScript(script.skin.helper.service,action=setresourceaddon,skinstring=WeatherIconPack,addontype=resource.images.weathericons)        

Helper which lets the user select a resource addon OR custom path on disk. Functionality is exactly the same as the Kodi addon Resource Image Select but with 2 differences:

  1. Also allows user to set a custom folder.
  2. Get more button lists all available addons of same type on repo (allowing direct install).

Parameters:

  • skinstring: the Skin String to save the result
  • addontype: The type of addon to list (e.g. resource.images.weathericons)

NOTES:

  • The result will be stored in both the given skinstring itself as in skinstring.path
  • skinstring.name will hold the name of the resource addon
  • skinstring.multi will be set to true if the selected addon or path contains multiple folders (multiimage)
  • skinstring.ext will be set to the default extension for images in the path (e.g. png or jpg)

Check resource addons

RunScript(RunScript(script.skin.helper.service,action=CHECKRESOURCEADDONS,ADDONSLIST=WeatherIconPack;resource.images.weathericons;Weather Icons|WeatherFanArtPack;resource.images.weatherfanart;Weather FanArt|StudioLogos;resource.images.studios;Studio Logos))        

Usefull in the scenario where your skin depends on several resource addons but you don't want to be forced to enforce defaults and set them as dependencies in your skin's addon.xml

What this feature does is checks your list of needed addons. If an addon is found, it will fill your skinstring with the path of the found addon. If nothing was installed, it will display a message asking the user to install an addon.

Parameters:

  • addonslist: A list of all the needed addons, in the following format:

SKINSTRING;RESOURCEADDONTYPE;LABEL FOR DIALOG

Multiple options are seperated by |