Kodi Community Forum

Full Version: script.skinshortcuts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Thank you
(2015-12-02, 13:15)Mr. V Wrote: [ -> ]Cheers Bob. It is working now. Big Grin

Great news. I was worried that one was going to prove a nasty one to track down - always glad to be wrong about that sort of thing! Fixes are now on git.

(2015-12-02, 18:42)Jayz2K Wrote: [ -> ]Hi, Bob

I was going to give a shot to the new DefaultProperty but I admit being a bit lost ATM and after reading the doc, I'm not sure to be able to achieve what I wanted when requested the DefaultProperty.

First, I didn't get from where the "GroupName" comes from :

PHP Code:
<propertydefault labelID="[LabelID]" group="[GroupName]" property="[Property]">[Property Value]</propertydefault

Then, what I wanted is for coming from an "already built" menu, add the Properties needed by my skin, as follow :

Condition : menu Item has "widgetPath" > Set DefaultProperty name="viewtype" as HOM.View2
Condition : menu Item hasn't "widgetPath" > Set DefaultProperty name="viewtype" as HOM.View1
Condition : menu Item has "widgetPath" & labelID="livetv" > Set DefaultProperty name="viewtype" as HOM.View3

Maybe using SetProperty(custom-grouping,[groupname]) and defining this "I think the same" groupname as "Widget" or "NotWidget" ? and then make it as follow ?

PHP Code:
<propertydefault group="Widget" property="viewtype">HOM.View2</propertydefault>
<
propertydefault group="NotWidget" property="viewtype">HOM.View1</propertydefault>
<
propertydefault group="WidgetTV" property="viewtype">HOM.View3</propertydefault

Thx in advance

Groupname is primarily for use when building additional menus unlinked to the main menu. What you want to do isn't possible at the moment - the code only allows a single fallback value in case the user hasn't set one. I'm trying to only do bug fixes at the moment, so I'll add conditional fallback values to my list to look at after a repo push (and may well come back to you so we can work out exactly what you need adding Smile)

(2015-12-02, 18:56)avia Wrote: [ -> ]Hi
how can now the answer?

http://forum.kodi.tv/showthread.php?tid=...pid2173338

In addition to what Hitcher said (and thanks Hitcher Smile), be aware that changes you make there will be overwritten when the script updates on the repo. You may consider doing a PR with your language changes, though even then it's worth noting that if the script is added to Transifex (the service Kodi uses to manage translations), any translations would then need to be done there as all the language files on git would get overwritten before repo pushes (not that I'm aware of any intention from anyone to ask for the script to be added to Transifex at the moment).
Is it somehow possible to point the widgetPath to a custom made static list? As an include so to speak? I would want to use it for a weather widget for example. Sure I could add a separate container specifically for that but if I can prevent that I will Wink
If using templates, you can set the property to an include. Harder to do without templates, as trying to use an include in the property causes issues with the xml... (Am about to leave to grab a train, so if you need more info - and no-one beats me to it - it won't be till Friday Smile)
(2015-12-02, 19:15)BobCratchett Wrote: [ -> ]
(2015-12-02, 18:42)Jayz2K Wrote: [ -> ]Hi, Bob

I was going to give a shot to the new DefaultProperty but I admit being a bit lost ATM and after reading the doc, I'm not sure to be able to achieve what I wanted when requested the DefaultProperty.

First, I didn't get from where the "GroupName" comes from :

PHP Code:
<propertydefault labelID="[LabelID]" group="[GroupName]" property="[Property]">[Property Value]</propertydefault

Then, what I wanted is for coming from an "already built" menu, add the Properties needed by my skin, as follow :

Condition : menu Item has "widgetPath" > Set DefaultProperty name="viewtype" as HOM.View2
Condition : menu Item hasn't "widgetPath" > Set DefaultProperty name="viewtype" as HOM.View1
Condition : menu Item has "widgetPath" & labelID="livetv" > Set DefaultProperty name="viewtype" as HOM.View3

Maybe using SetProperty(custom-grouping,[groupname]) and defining this "I think the same" groupname as "Widget" or "NotWidget" ? and then make it as follow ?

PHP Code:
<propertydefault group="NotWidget" property="viewtype">HOM.View1</propertydefault>
<
propertydefault group="WidgetTV" property="viewtype">HOM.View3</propertydefault

Thx in advance

Groupname is primarily for use when building additional menus unlinked to the main menu. What you want to do isn't possible at the moment - the code only allows a single fallback value in case the user hasn't set one. I'm trying to only do bug fixes at the moment, so I'll add conditional fallback values to my list to look at after a repo push (and may well come back to you so we can work out exactly what you need adding Smile)

This is a similar issue I was having. A conditional property fallback would be of great help. I wanted to set a condition for a widget menu property so a particular type of widget artwork can be set.

For example, something like this would definitely allow for more flexibility.

<propertyfallback tag="widgetArt" attribute="name|widgetType" condition="songs">Square Poster</propertyfallback>
<propertyfallback tag="widgetArt" attribute="name|widgetType" condition="albums">Square Poster</propertyfallback>
<propertyfallback tag="widgetArt" attribute="name|widgetType" condition="movies">Poster</propertyfallback>
<propertyfallback tag="widgetArt" attribute="name|widgetType" condition="episodes">Poster</propertyfallback>


Also if a certain menu property does not exist or is empty such as widget path it will not set the fallback. In my case for the template I use, it will not build if the widgetPath has not been set

<propertyfallback tag="widgetStyle" attribute="name|widgetPath" empty="false">Panel</propertyfallback>

the tag "empty"=[true/false]: if false it will not set the fallback if the attribute widgetPath is does not exist or is empty.

Would be great if something like this could be done. Smile
(2015-12-02, 19:15)BobCratchett Wrote: [ -> ]Groupname is primarily for use when building additional menus unlinked to the main menu. What you want to do isn't possible at the moment - the code only allows a single fallback value in case the user hasn't set one. I'm trying to only do bug fixes at the moment, so I'll add conditional fallback values to my list to look at after a repo push (and may well come back to you so we can work out exactly what you need adding Smile)

Well, that's what I thought. I didn't get it that bad :p
No worries and no rush Bob, and thanks for taking this into consideration. Sorry for asking again for unconventional features and assuming it's mostly for a "first skin start", it can wait a lil more. However, because widgets are part of the script's core, conditional Default props sounds making sens ?

Good luck in your bugs chase !

EDIT :

(2015-12-02, 23:14)Mr. V Wrote: [ -> ]<propertyfallback tag="widgetArt" attribute="name|widgetType" condition="movies">Poster</propertyfallback>

<propertyfallback tag="widgetStyle" attribute="name|widgetPath" empty="false">Panel</propertyfallback>

+1 ... I like the typo idea Wink . Looks similar to what we use to use.

EDIT 2 : One more question, what is providing content for those widgets :

Code:
<content>video</content>
      <node label="32040">
            <content>playlist-video</content>
      </node>
      ...

Because since a few, the playlist doesn't show episodes thumbs for 'In progress TV Shows' ... I get poster instead. Is this Library.Data or a SkinShortcuts built playlist from it ?
(2015-12-02, 22:20)BobCratchett Wrote: [ -> ]If using templates, you can set the property to an include. Harder to do without templates, as trying to use an include in the property causes issues with the xml... (Am about to leave to grab a train, so if you need more info - and no-one beats me to it - it won't be till Friday Smile)

I think I am going to need a little help Confused

So, I have my widget container which has the content path and target:

PHP Code:
...
<
content target="$INFO[Container(9000).ListItem.Property(widgetTarget)]">$INFO[Container(9000).ListItem.Property(widgetPath)]</content>
... 

Which is used by all widgets.

In my overrides.xml I have this in place:

PHP Code:
<widgetdefaultnode defaultID="weather" label="8" group="mainmenu" type="Weather" path="$INCLUDE[WeatherForecast]target="?">WeatherForecast</widgetdefaultnode

What does the target need to be set on in this case? Does it even matter?

Would my template need to look at least something like this?

PHP Code:
<template>
    <
other include="WeatherForecast">
        <
condition tag="property" attribute="name|widgetPath"></condition>
        <
controls>
            <
item id="1">
                <
label>test1</label>
                <
label2>test2</label2>
                <
thumb>test.png</thumb>
                <
onclick>ActivateWindow(weather)</onclick>
            </
item>
        </
controls>
    </
other>
</
template

Or would I need to bring over the entire container which is now in a "normal" include xml and use that for all widgets?

I feel like I'm completely off here Rofl
Glad I'm not the only one struggling to get to grips with templates. Wink
(2015-12-03, 09:02)Jeroen Wrote: [ -> ]I think I am going to need a little help Confused

So, I have my widget container which has the content path and target:

PHP Code:
...
<
content target="$INFO[Container(9000).ListItem.Property(widgetTarget)]">$INFO[Container(9000).ListItem.Property(widgetPath)]</content>
... 

Which is used by all widgets.

In my overrides.xml I have this in place:

PHP Code:
<widgetdefaultnode defaultID="weather" label="8" group="mainmenu" type="Weather" path="$INCLUDE[WeatherForecast]target="?">WeatherForecast</widgetdefaultnode

What does the target need to be set on in this case? Does it even matter?

Would my template need to look at least something like this?

PHP Code:
<template>
    <
other include="WeatherForecast">
        <
condition tag="property" attribute="name|widgetPath"></condition>
        <
controls>
            <
item id="1">
                <
label>test1</label>
                <
label2>test2</label2>
                <
thumb>test.png</thumb>
                <
onclick>ActivateWindow(weather)</onclick>
            </
item>
        </
controls>
    </
other>
</
template

Or would I need to bring over the entire container which is now in a "normal" include xml and use that for all widgets?

I feel like I'm completely off here Rofl

What I'm doing for this is passing all the needed SkinShortcuts entries to an include. This way I manage widgets inside skin files

You can set your node as shortcut :

PHP Code:
<node label="31147"
       <
shortcut label="8" widget="WeatherForecast" widgetType="Weather">WeatherForecast</shortcut
</
node

Then made a Template passing the entries to Home like :

PHP Code:
<template>

    <
other include="MyWidgets">
        <
property attribute="name|widgetPath" tag="property" name="path"/>
        <
property attribute="name|widgetTarget" tag="property" name="target"/>
        <
property name="target"/>
        <
property name="id" tag="mainmenuid" />

        <
controls>

            <
control type="group">
                <
skinshortcuts>visibility</skinshortcuts>
                <include 
name="MyWidgetsInclude">
                    <
param name="Id" value="80$SKINSHORTCUTS[id]/>
                    <
param name="Target" value="$SKINSHORTCUTS[target]/>
                    <
param name="Path" value="$SKINSHORTCUTS[path]/>
                </include>
            </
control>

        </
controls>
    </
other>

</
template

I call the Template in Home.xml :

PHP Code:
<include>skinshortcuts-template-MyWidgets</include> 

And finally placed the include layout calling the entries in my includes.xml :

PHP Code:
<include name="MyWidgetsInclude">
      <
control type="panel" id="$PARAM[Id]">
            ...
            <
content target="$PARAM[Target]">$PARAM[Path]</content>
      </
control>
</include> 

This way you can manage any kind of widgets with the same layout directly in "includes.xml". The downside of this is the "includes" refreshing problem, that's why I'm also passing a $PARAM[Id] to change the container Id (so they each have a different one and can be managed individually). I you want to make different containers for different widgets, you can also StringCompare $PARAMs.

I'm not sure it's the easiest way but it works and I find it flexible to manage Inside the skin layout Wink
(2015-12-03, 09:02)Jeroen Wrote: [ -> ]
(2015-12-02, 22:20)BobCratchett Wrote: [ -> ]If using templates, you can set the property to an include. Harder to do without templates, as trying to use an include in the property causes issues with the xml... (Am about to leave to grab a train, so if you need more info - and no-one beats me to it - it won't be till Friday Smile)

I think I am going to need a little help Confused

So, I have my widget container which has the content path and target:

PHP Code:
...
<
content target="$INFO[Container(9000).ListItem.Property(widgetTarget)]">$INFO[Container(9000).ListItem.Property(widgetPath)]</content>
... 

Which is used by all widgets.

In my overrides.xml I have this in place:

PHP Code:
<widgetdefaultnode defaultID="weather" label="8" group="mainmenu" type="Weather" path="$INCLUDE[WeatherForecast]target="?">WeatherForecast</widgetdefaultnode

What does the target need to be set on in this case? Does it even matter?

Would my template need to look at least something like this?

PHP Code:
<template>
    <
other include="WeatherForecast">
        <
condition tag="property" attribute="name|widgetPath"></condition>
        <
controls>
            <
item id="1">
                <
label>test1</label>
                <
label2>test2</label2>
                <
thumb>test.png</thumb>
                <
onclick>ActivateWindow(weather)</onclick>
            </
item>
        </
controls>
    </
other>
</
template

Or would I need to bring over the entire container which is now in a "normal" include xml and use that for all widgets?

I feel like I'm completely off here Rofl

This will have to be a really quick answer, my apologies.

The template would have to look something like...

PHP Code:
<template>

    <
other include="WeatherForecast">
        <!-- 
To be clearthis will match against any menu items with a <property name="widgetPath" /> element -->
        <
condition tag="property" attribute="name|widgetPath"></condition>

        <!-- 
Pull out the widgetPath and widgetTarget properties from the menu item -->
        <
property name="path" tag="property" attribute="name|widgetPath" />
        <
property name="target" tag="property" attribute="name|widgetTarget" />

        <!-- 
Kodi GUI controls the actual list that the widget will be displayed in... ;) -->
        <
controls>
            <
control type="list" id="9002">
                <
skinshortcuts>visibility</skinshortcuts>
                <
top>...</top>
                <
left>...</left>
                ...
                <
itemlayout>
                    ...
                </
itemlayout>
                <
focusedlayout>
                    ...
                </
focusedlayout>

                <!-- 
Now insert the properties we pulled from the main menu -->
                <
content target="$SKINSHORTCUTS[target]">$SKINSHORTCUTS[path]</content>
        </
controls>
    </
other>
</
template

The <include name="WeatherForecast"> would still be wherever you keep includes (most likely includes.xml Wink) - the $SKINSHORTCUTS[path] will be replaced with <include>WeatherForecast</include>. For weather, yes target could be empty Smile.

(Unless you just want to use templates for weather - in which case simplify Smile In the <condition /> check for the weather widget specifically, have the entire gui be the $SKINSHORTCUTS[path] (though it has to be in an element - <content>HERE</content> or attribute <content attrib="HERE" />, and no - the <controls /> doesn't count Wink) and have the entire static list, container and all, in the include.)

Templates are still in their infancy, feel free to offer suggestions for improvements.

I know there's other queries in the thread, I'll look at them when I get time (probably tomorrow.)
Many thanks Jayz2K and Bob, I will look into it ASAP, I am sure your examples will help out a lot!
This example of my widget implementation might be some help for you all using templates. I used templates to completely code the widgets along with $PARAM Includes.

template.xml
overrides.xml
Includes_Widgets.xml

You could probably copy and paste most of this into any skin with some texture and co-ordinate changes.
@Jayz2K - That's a nice way to integrate the templates and the skin-side stuff. Fancy doing a brief write-up for the docs...? Big Grin

@Mr. V - I looked through your template the other day and was impressed Smile Can I link to it when people want a good example in the future?

(2015-12-02, 23:22)Jayz2K Wrote: [ -> ]EDIT 2 : One more question, what is providing content for those widgets :

Code:
<content>video</content>
      <node label="32040">
            <content>playlist-video</content>
      </node>
      ...

Because since a few, the playlist doesn't show episodes thumbs for 'In progress TV Shows' ... I get poster instead. Is this Library.Data or a SkinShortcuts built playlist from it ?

Actually they're the users + skins playlists, with the path to the playlist passed through as the widgetPath property.
(2015-12-03, 23:29)BobCratchett Wrote: [ -> ]@Mr. V - I looked through your template the other day and was impressed Smile Can I link to it when people want a good example in the future?

Fine by me. Smile
(2015-12-03, 23:29)BobCratchett Wrote: [ -> ]@Jayz2K - That's a nice way to integrate the templates and the skin-side stuff. Fancy doing a brief write-up for the docs...? Big Grin

Thanks Bob. Sure, what kind of doc you have in mind ? A concrete example or a more general explaination ? Or both ?

(2015-12-03, 23:29)BobCratchett Wrote: [ -> ]Actually they're the users + skins playlists, with the path to the playlist passed through as the widgetPath property.

So, it doesn't come from there. I really have to have a closer look to the content definitions. I actually have an xml file as widgetPath for InProgressTvShows but have no user or skin playlists. Maybe one of Skin.Helper's presets ... Not sure. I admit being less confortable on this part to gather different content providers.