Kodi Community Forum

Full Version: VideoOSD default button help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all.

I am fairly new to skinning so apologies in advance...

I am trying to create a condition whereby the default selected button is different than that of the default when a certain string of text exists in the TvShowTitle.

So when the word Live starts in the TvShowTitle, the default button is 15(Stop) and not 14.

My VideoOSD from my eminence skin looks like this

VideoOSD.xml:
<?xml version="1.0" encoding="UTF-8"?>
<window>
        <defaultcontrol always="true">14</defaultcontrol>

    <onunload>ClearProperty(osdinfo,home)</onunload>
        <controls>
        <include>Window_OSD</include>

        <control type="slider">
            <width>100%</width>
            <bottom>64</bottom>
            <height>16</height>
            <texturesliderbar>-</texturesliderbar>
            <textureslidernib>-</textureslidernib>
            <textureslidernibfocus>-</textureslidernibfocus>
            <info>Player.Progress</info>
            <action>seek</action>
        </control>
        </controls>

</window>

I have used the condition method and !String.StartsWith in various other places in the skin and this works fine: !String.StartsWith(VideoPlayer.TvShowTitle,Live)

However as VideoOSD.xml sets this as 14, I cannot find a way to say use 15 is there is a matching condition of !String.StartsWith(VideoPlayer.TvShowTitle,Live)

Any advice? I have battled for a little while now.

Thank you.
Have you tried?
xml:
<onload condition="!String.StartsWith(VideoPlayer.TvShowTitle,Live)">SetFocus(15)</onload>


Another approach is to include the default control tag depending on a condition e.g.
In Includes.xml
xml:

<include name="DefaultControl14"><defaultcontrol always="true">14</defaultcontrol></include>
<include name="DefaultControl15"><defaultcontrol always="true">15</defaultcontrol></include>

Then in your videoosd.xml
xml:

<include condition="!String.StartsWith(VideoPlayer.TvShowTitle,Live)">DefaultControl15</include>
<include condition="String.StartsWith(VideoPlayer.TvShowTitle,Live)">DefaultControl14</include>
(2019-07-17, 13:57)jurialmunkey Wrote: [ -> ]Have you tried?
xml:
<onload condition="!String.StartsWith(VideoPlayer.TvShowTitle,Live)">SetFocus(15)</onload>


Another approach is to include the default control tag depending on a condition e.g.
In Includes.xml
xml:

<include name="DefaultControl14"><defaultcontrol always="true">14</defaultcontrol></include>
<include name="DefaultControl15"><defaultcontrol always="true">15</defaultcontrol></include>

Then in your videoosd.xml
xml:

<include condition="!String.StartsWith(VideoPlayer.TvShowTitle,Live)">DefaultControl15</include>
<include condition="String.StartsWith(VideoPlayer.TvShowTitle,Live)">DefaultControl14</include>

Superb! Thank you very much, this has worked perfectly.

I wonder if I could trouble you with one more problem...

Code:
               <control type="button" id="15">
                        <description>Stop</description>
                        <width>48</width>
                        <height>48</height>
                        <label></label>
                        <font>Cloudworld</font>
                        <onup>9100</onup>
                        <texturefocus colordiffuse="$VAR[HighlightColor]">osd/stop.png</texturefocus>
                        <texturenofocus colordiffuse="ListLabel">osd/stop.png</texturenofocus>
                        <usealttexture>String.StartsWith(VideoPlayer.TvShowTitle,Live)</usealttexture>
                        <alttexturefocus colordiffuse="$VAR[HighlightColor]">osd/stop2.png</alttexturefocus>
                        <alttexturenofocus colordiffuse="LineLabel">osd/stop2.png</alttexturenofocus>
                        <onclick>PlayerControl(Stop)</onclick>
                        <onclick>Close</onclick>
                    </control>


The above is from my Includes_Window.xml.

What I am trying to do is use an alternative texture for when that same condition exists, however... It is displaying stop.png irrelevent of either condition. I believe it should be working, but it is not, any ideas?

Many thanks again
Ah ignore that I have solved it, I needed to be using controltype togglebutton!