-
-
Notifications
You must be signed in to change notification settings - Fork 15
Script: Actions and helpers
Closes all dialogs and goes to provided path. If a media window is active it updates the window content instead of destroying the window history.
RunScript(script.embuary.helper,action=goto,path='$ESCINFO[ListItem.Filenameandpath]',target=videos)
Plays item via PlayMedia() or JSONRPC but closes all dialogs before.
Playback started via PlayMedia()
RunScript(script.embuary.helper,action=playitem,item='$ESCINFO[ListItem.Filenameandpath]')
Playback started via JSONRPC (supported types are 'movie', 'episode' and 'song')
RunScript(script.embuary.helper,action=playitem,item=$INFO[ListItem.DBID],type=$INFO[ListItem.DBType]
Plays .wav file. Benefit: SFX sounds are not touching the player at all. GUI and player sounds are still hearable even if the .wav is played.
RunScript(script.embuary.helper,action=playsfx,path='"special://skin/extras/holiday/winterintro.wav"')
To stop the SFX playback:
RunScript(script.embuary.helper,action=stopsfx)
Plays all content of a container. This is also supported for widgets if a command is provided to the widget container.
Optional arguments
-
id=
(container ID) -
method=
(shuffle / fromhere)
Example: Play all items
RunScript(script.embuary.helper,action=playall)
Example: Play all items with shuffle enabled
RunScript(script.embuary.helper,action=playall,method=shuffle)
Example: Play all items from here from a widget with ID 123 (starting from the current focus position)
RunScript(script.embuary.helper,action=playall,id=123,method=fromhere)
Plays all content of a TV show or season folder.
Optional arguments
-
shuffle=true
(to randomize the playback)
Example: Play all episodes of a TV show by providing its DBID
RunScript(script.embuary.helper,action=playfolder,dbid=$INFO[ListItem.DBID],shuffle=true)
Example: Play and shuffle all episodes of a season by providing its season DBID
RunScript(script.embuary.helper,action=playfolder,dbid=$INFO[ListItem.DBID],type=season)
Plays a random item of the container or of a widget
Optional argument
-
id=
(widget container ID)
RunScript(script.embuary.helper,action=playrandom,id=123)
Resets all container positions to 0. Multiple ID's have to be splitted by ||
.
Optional argument
-
only=inactive
(only reset position for not focused items)
RunScript(script.embuary.helper,action=resetposition,container=101||102||103||104||105||106,only=inactive)
Closes all dialogs and jumps to the root of the TV show with provided DBID.
RunScript(script.embuary.helper,action=jumptoshow_by_episode,dbid=$INFO[ListItem.DBID])
Useful if you want to get TV show values on season level.
Returned properties
-
Window(home).Property(tvshow.dbid)
(TV show DBID) -
Window(home).Property(tvshow.rating)
(TV show rating) -
Window(home).Property(tvshow.seasons)
(Total TV show seasons) -
Window(home).Property(tvshow.episodes)
(Total TV show episodes) -
Window(home).Property(tvshow.watchedepisodes)
(Total TV show watched episodes) -
Window(home).Property(tvshow.unwatchedepisodes)
(Total TV show unwatched episodes)
Example invisible overlay as call on season level
<?xml version="1.0" encoding="UTF-8"?>
<window id="1118" type="dialog">
<visible>Container.Content(seasons) + String.IsEmpty(Container.Pluginname)</visible>
<onload condition="Integer.IsGreater(ListItemAbsolute(0).Season,0) + !String.IsEmpty(Container.ListItemAbsolute(0).DBID)">RunScript(script.embuary.helper,action=details_by_season,dbid=$INFO[Container.ListItemAbsolute(0).DBID])</onload>
<onload condition="Integer.IsGreater(ListItemAbsolute(1).Season,0) + !String.IsEmpty(Container.ListItemAbsolute(1).DBID)">RunScript(script.embuary.helper,action=details_by_season,dbid=$INFO[Container.ListItemAbsolute(1).DBID])</onload>
<onload condition="Integer.IsGreater(ListItemAbsolute(2).Season,0) + !String.IsEmpty(Container.ListItemAbsolute(2).DBID)">RunScript(script.embuary.helper,action=details_by_season,dbid=$INFO[Container.ListItemAbsolute(2).DBID])</onload>
<onload condition="Integer.IsGreater(ListItemAbsolute(3).Season,0) + !String.IsEmpty(Container.ListItemAbsolute(3).DBID)">RunScript(script.embuary.helper,action=details_by_season,dbid=$INFO[Container.ListItemAbsolute(3).DBID])</onload>
<onunload>ClearProperty(tvshow.dbid,home)</onunload>
<onunload>ClearProperty(tvshow.rating,home)</onunload>
<onunload>ClearProperty(tvshow.seasons,home)</onunload>
<onunload>ClearProperty(tvshow.episodes,home)</onunload>
<onunload>ClearProperty(tvshow.watchedepisodes,home)</onunload>
<onunload>ClearProperty(tvshow.unwatchedepisodes,home)</onunload>
<controls/>
</window>
Blurs provided image and saves its path to a window property.
Optional arguments
-
prop=
(Prefix of the property. Default = "output") -
radius=
(Blurring strength. Script default is "2", but this can be different if a skin setting has overwritten it.)
Example
RunScript(script.embuary.helper,action=blurimg,file='"special://skin/extras/file.jpg"',prop=MyProp,radius=4)
Result
-
Window(home).Property(MyProp_blurred)
= the image path -
Window(home).Property(MyProp_color)
= the average color
Splits a provided value by the set separator to window properties.
Arguments
-
value=
(required) -
prop=
(required) -
separator=
(optional, default splitting is done by lines)
Example
RunScript(script.embuary.helper,action=split,value='$ESCINFO[ListItem.Genre]',separator='" / "',prop=MySplit)
Result example
Window(home).Property(MySplit.0)
Window(home).Property(MySplit.1)
Window(home).Property(MySplit.2)
Returns true
if file exists. Otherwise the window property is going to be cleared.
Arguments
-
file=
(required) -
prop=
(optional, default is "FileExists")
Example
RunScript(script.embuary.helper,action=lookforfile,file='"C:\install.log"',prop=MyProp)
Result
Window(home).Property(MyProp)
= true or empty
Updates a info value of a stored library item. Please check https://kodi.wiki/view/JSON-RPC_API/v9 for reference.
RunScript(script.embuary.helper,action=setinfo,dbid=$INFO[ListItem.DBID],type=$INFO[ListItem.DBType],field=playcount,value=0)
Store content of a .txt file in a window property.
Example
RunScript(script.embuary.helper,action=txtfile,path=special://skin/changelog.txt,header=$LOCALIZE[24036],prop=MyWindowProp)
Result
Window(home).Property(MyWindowProp)
Stores the system locale in short form as windows property. Example results: DE, EN, CN, etc.
RunScript(script.embuary.helper,action=getlocale)
Result
Window(home).Property(SystemLocale)
A more detailed alternative to Kodi's builtin AlarmClock()
function.
Example
RunScript(script.embuary.helper,action=settimer,do='"Runscript(...)||Notification(header,message)"',time=5000,delay=100,busydialog=false)
Arguments
-
do=
(required, stores the action(s) that should be executed. Multiple actions can be run by adding||
as separator) -
time=
(optional, default is 50ms. The amount of time to wait before the actions are going to be executed) -
delay=
(optional, default is 0ms. Useful if you want to pause between the actions) -
busydialog=
(optional, default is true. Shows the busydialog before actions are going to be processed)
Encodes/decodes a provided string to a window property.
Encode
RunScript(script.embuary.helper,action=encode,string='"Umlauts & special characters, they always drive me crazy"',prop=MyEncodedString)
Decode
RunScript(script.embuary.helper,action=decode,string=Umlauts%20%26%20special%20characters%2C%20they%20always%20drive%20me%20crazy,prop=MyDecodedString)
Result
Window(home).Property(MyEncodedString)
Window(home).Property(MyDecodedString)
Arguments
-
string=
(required) -
prop=
(optional, defaults areEncodedString
andDecodedString
)
Performs simple math operations and stores the restult to a property.
Example
RunScript(script.embuary.helper,action=calc,do='"(10 + 5) / 2"',prop=MyResult)
Result
Window(home).Property(MyResult)
= 7.5
Arguments
-
do=
(math operation wrapped in'" "'
) -
prop=
(optional, default isCalcResult
)
Stores an add-on setting to a window property.
Example
RunScript(script.embuary.helper,action=getaddonsetting,addon=plugin.video.embycon,setting=group_movies)
Result
Window(home).Property(plugin.video.embycon-group_movies)
= true
Arguments
-
addon=
(the addon ID) -
setting=
(the setting - take a look at the settings.xml of the addon in the addon_data folder)
Returns width, height and aspect ratio of provided image path.
Example
RunScript(script.embuary.helper,action=imginfo,img=$INFO[ListItem.Icon],prop=MyImage)
Result
-
Window(home).Property(MyImage.width)
= width -
Window(home).Property(MyImage.height)
= height -
Window(home).Property(MyImage.ar)
= aspect ratio (eg: 1.78)
Arguments
-
img=
(the image) -
prop=
(optional, default isimg
)
script and wiki created by sualfred
- Go to path
- Play item
- Play SFX sound
- Play all, shuffled, from here
- Play folder
- Play random
- Reset container positions
- Browse TV show of episode
- Get TV show details
- Blur image
- Split value
- Check if file exists
- Update library item
- Get .txt file content
- Get system locale
- Set timer
- Encode/decode string
- Calculate
- Get add-on setting
- Image dimension and aspect ratio
- Attention & warning
- Auto font change
- Set Kodi setting
- Get Kodi setting
- Toggle Kodi setting
- Disable/enable add-ons
- The background service
- Restarting the service
- Global background images
- Auto playlist clearing
- Auto refresh widgets
- Player audio track detection
- Player audio and subtitle info labels
- Channel logo of playing recording
- Artist and album artworks for music playback
- Auto fullscreen on playback
- Next item of video playlist
- Player artwork dimension and aspect ratio
- Player icon blurring
- Detect / populate library tags
- In progress media
- Media by random genre
- Get more items of random actor
- Get more items by given actor
- In progress movies
- Suggestions based on watched movies
- Similar movies based on movie
- Movies by random genre
- Movie genres
- Directed by