-
-
Notifications
You must be signed in to change notification settings - Fork 15
Service: Running tasks
This script is running different tasks to communicate to functions on events or give features to the Embuary skin. Some of this things are might be useful to be used on other skins as well.
Note: The background and player monitor services can be disabled in the add-on settings.
Some features, like the background blurring daemon, require a service restart after they were enabled. This can easily be done by calling:
RunScript(script.embuary.helper,action=restartservice)
The script is calling the database in a interval to get a random set of 40 movie, 40 TV show and 40 artist fanarts. These background images are going to be stored in window propertyies, which are changing every 10s.
Available properties
-
$INFO[Window(home).Property(EmbuaryBackground)]
(mix of all) -
$INFO[Window(home).Property(EmbuaryBackgroundVideos)]
(mix of movies + TV shows) -
$INFO[Window(home).Property(EmbuaryBackgroundMovies)]
(movies) -
$INFO[Window(home).Property(EmbuaryBackgroundTVShows)]
(TV shows) -
$INFO[Window(home).Property(EmbuaryBackgroundMusic)]
(artists)
Note: The 10s interval can be adjusted in the addon config and skinners also can override this value by using a skin setting, eg:
Skin.String(BackgroundInterval,40)
Kodi has a stupid bug with dynamic content containers. All widgets, or PlayMedia commands, are using the music playlist no matter if the item that is going to be played is a music or video item. It's a corner case issue, but skinners are having troubles to open the correct playlist window because this behaviour can lead into a filled music and video playlist. That means we have no option to check what is the correct and currently used one.
The background service offers the option to get rid of this issue by clearing the old existing playlist by listening to the playlist.onadd event. That means a existing video playlist is going to be cleared if a item is going to be added to the music playlist.
This "helper" is disabled by default and has to be enabled.
Enable the playlist monitor
<onload condition="!Skin.HasSetting(ClearPlaylist)">Skin.ToggleSetting(ClearPlaylist)</onload>
Useful to refresh dynamic widget containers. The service is providing a refresh interval to a window property after:
- a library item has been updated
- every 10 minutes
Just add &reload=$INFO[Window(home).Property(EmbuaryWidgetUpdate)
to the end of a content path.
Simple example
<content>plugin://script.embuary.helper/?info=getinprogress&reload=$INFO[Window(home).Property(EmbuaryWidgetUpdate)]</content>
The service checks the playing item for all available audio languages. Useful for skinners who want to show a "change audiotrack" button if more than 1 track is available.
Example
<control type="button" id="614">
<onclick>action(AudioNextLanguage)</onclick>
<visible>!String.IsEmpty(Window(home).Property(EmbuaryPlayerAudioTracks))</visible>
<visible>!String.IsEmpty(VideoPlayer.AudioLanguage)</visible>
<visible>!VideoPlayer.Content(musicvideos)</visible>
</control>
All VideoPlayer.Audio* info values of Kodi only return the current active track. There is no builtin way to get the additional available ones. The service will call a database query on playback start and adds the result to window properties.
Result (%i = 0,1,2,3,4, etc)
- Window(home).Property(AudioCodec.%i)
- Window(home).Property(AudioChannels.%i)
- Window(home).Property(AudioLanguage.%i)
- Window(home).Property(SubtitleLanguage.%i)
There is no Kodi builtin way to get the channel logo of a playing recording, if it has a EPG thumb stored. The service tries to find the correct channel logo by the channel name and fills it to a window property.
Example
<texture>$INFO[Window(home).Property(Player.ChannelLogo)]</texture>
The script automatically adds artworks to the currently playing song if some of them are missing (like discart of the album). This is usually the case if the a song is going to be played from a widget outside of the music database. This is happen automatically and needs no further implementation.
Only for Kodi Leia - not required in Kodi Matrix
This feature forces Kodi to switch to fullscreen when playback is going to be started. It's disabled by default.
Enable/disable auto fullscreen
Skin.ToggleSetting(StartPlayerFullscreen)
Only for Kodi Leia - not required in Kodi Matrix
There is no Kodi builtin to get information about the next queued playlist item of the video player. This monitor gets rid of this issue and stores nearly all available info labels as window property. The info labels get fetched automatically and there is no need to activate this feature.
Available properties (if information exists)
- Window(home).Property(VideoPlayer.Next.Title)
- Window(home).Property(VideoPlayer.Next.TVShowTitle)
- Window(home).Property(VideoPlayer.Next.Season)
- Window(home).Property(VideoPlayer.Next.Episode)
- Window(home).Property(VideoPlayer.Next.Tagline)
- Window(home).Property(VideoPlayer.Next.Rating)
- Window(home).Property(VideoPlayer.Next.UserRating)
- Window(home).Property(VideoPlayer.Next.Duration) returns HH:MM:SS
- Window(home).Property(VideoPlayer.Next.Duration(m)) returns minutes
- Window(home).Property(VideoPlayer.Next.Duration(s)) returns seconds
- Window(home).Property(VideoPlayer.Next.DBType)
- Window(home).Property(VideoPlayer.Next.DBID)
- Window(home).Property(VideoPlayer.Next.Year)
- Window(home).Property(VideoPlayer.Next.Art(thumb))
- Window(home).Property(VideoPlayer.Next.Art(fanart))
- Window(home).Property(VideoPlayer.Next.Art(poster))
- Window(home).Property(VideoPlayer.Next.Art(tvshow.poster))
- Window(home).Property(VideoPlayer.Next.Art(clearart))
- Window(home).Property(VideoPlayer.Next.Art(tvshow.clearart))
- Window(home).Property(VideoPlayer.Next.Art(landscape))
- Window(home).Property(VideoPlayer.Next.Art(tvshow.landscape))
- Window(home).Property(VideoPlayer.Next.Art(clearlogo))
- Window(home).Property(VideoPlayer.Next.Art(tvshow.clearlogo))
- Window(home).Property(VideoPlayer.Next.Art(banner))
- Window(home).Property(VideoPlayer.Next.Art(tvshow.banner))
Stores width, height and aspect ratio of the most common player artwork info labels in window properties.
Available properties
-
$INFO[Window(home).Property(Player.Icon.width)]
(width) -
$INFO[Window(home).Property(Player.Icon.height)]
(height) -
$INFO[Window(home).Property(Player.Icon.ar)]
(aspect ratio) -
$INFO[Window(home).Property(Player.Art(poster).width)]
(width) -
$INFO[Window(home).Property(Player.Art(poster).height)]
(height) -
$INFO[Window(home).Property(Player.Art(poster).ar)]
(aspect ratio) -
$INFO[Window(home).Property(Player.Art(tvshow.poster).width)]
(width) -
$INFO[Window(home).Property(Player.Art(tvshow.poster).height)]
(height) -
$INFO[Window(home).Property(Player.Art(tvshow.poster).ar)]
(aspect ratio) -
$INFO[Window(home).Property(Pvr.EPGEventIcon.width)]
(width) -
$INFO[Window(home).Property(Pvr.EPGEventIcon.height)]
(height) -
$INFO[Window(home).Property(Pvr.EPGEventIcon.ar)]
(aspect ratio)
Blurs the player icon with a radius of 5. Disabled by default. To enable it:
<onload condition="!Skin.HasSetting(BlurPlayerIcon)">Skin.ToggleSetting(BlurPlayerIcon)</onload>
*Available properties
$INFO[Window(home).Property(playericon_blurred)]
$INFO[Window(home).Property(playericon_color)]
A task is scanning the video DB for library tags on startup, library scan or cleanup and stores them in window properties. With this info labels skinners have the option to automatically populate hubs based on library tags for example.
This feature has a whitelist to enable/disable tags you don't want to have populated.
Future and new tags can be automatically whitelisted by setting Skin.SetBool(AutoLibraryTags)
.
To edit the whitelist: RunScript(script.embuary.helper,action=selecttags)
Available properties (if information exists; %n = 0,1,2,...29 )
-
$INFO[Window(home).Property(library.tags.%n.title)]
(whitelisted tag name) -
$INFO[Window(home).Property(library.tags.%n.id)]
(whitelisted tag dbid) -
$INFO[Window(home).Property(library.tags.%n.type)]
(whitelisted type ->movies
,tvshows
ormixed
if tag exists for both types) -
$INFO[Window(home).Property(library.tags]
(whitelisted tags) -
$INFO[Window(home).Property(library.tags.all]
(all found tags)
Note: Only 30 props are supported (enough for 99,9% of all setups)
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