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.
(2015-12-04, 01:07)Jayz2K Wrote: [ -> ]
(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 ?

A general explanation about passing the properties back as a param along with a simple example would be fantastic Smile

(2015-12-04, 01:07)Jayz2K Wrote: [ -> ]
(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.

If it's not coming from a playlist, there's only one 'In Progress TV Shows' I know of, which is the video library node (in which case the widgetPath is set to the path to that node, which is ultimately an xml file...) I don't believe any of the widget providers have 'In Progress TV Shows', though they may have something that works the same just with a different name (Library Data Providers 'Recommended Episodes', for example)
(2015-12-04, 01:13)BobCratchett Wrote: [ -> ]A general explanation about passing the properties back as a param along with a simple example would be fantastic Smile

Fine, will do that.

Quote:If it's not coming from a playlist, there's only one 'In Progress TV Shows' I know of, which is the video library node (in which case the widgetPath is set to the path to that node, which is ultimately an xml file...) I don't believe any of the widget providers have 'In Progress TV Shows', though they may have something that works the same just with a different name (Library Data Providers 'Recommended Episodes', for example)

Hmmm, well, as far as I tested, episode thumb returns me now TV show poster instead but I don't know where to report this ...
(2015-12-04, 01:30)Jayz2K Wrote: [ -> ]Fine, will do that.

Appreciated Smile

(2015-12-04, 01:30)Jayz2K Wrote: [ -> ]Hmmm, well, as far as I tested, episode thumb returns me now TV show poster instead but I don't know where to report this ...

It depends where the In Progress TV Shows is coming from, but from a quick test the library node is returning the tv shows - not individual episodes - and so doesn't have the episode thumbs available. Library Data Provider's Recommended Episodes shows individual episodes, and is giving me the episode thumbs no problem.
So I have been making some progress, thank you all for the help. I have my "normal" widgets actually showing up, even that feels like an achievement Rofl

I am still quite in the dark about how I can actually use

<content target="$SKINSHORTCUTS[target]">$SKINSHORTCUTS[path]</content>

for the regular widgets

and somehow substitute the path here for a regular include containing the static list content.

I have been switching back and forth between some of the methods posted here but it is quite overwhelming, I feel like I'm missing something totally obvious here.

A shortened version of my template:

Code:
<other include="Widgets">
        <!-- This 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" />

        <controls>
            <control type="list" id="9300">
                <skinshortcuts>visibility</skinshortcuts>
                <left>0</left>
                <width>1620</width>
                <height>720</height>
                <include>focus</include>

                <itemlayout width="1280" height="720">
                    <control type="image">
                        <width>1280</width>
                        <height>720</height>
                        <texture>$INFO[ListItem.Art(fanart)]</texture>
                        <aspectratio>scale</aspectratio>
                    </control>
                </itemlayout>
                <focusedlayout width="1280" height="720">
                    <control type="image">
                        <width>1280</width>
                        <height>720</height>
                        <texture>$INFO[ListItem.Art(fanart)]</texture>
                        <aspectratio>scale</aspectratio>
                        <include>fadeinout</include>
                    </control>
                </focusedlayout>

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

I tried using an conditional include before the content tag and loads more but I'm afraid this is going to keep me busy for a while!
You're almost there Smile

With that template, $SKINSHORTCUTS[target/path] should be used by all the node widgets (Library Data Provider, library nodes, add-on nodes, etc) automatically. To use them for a weather widget where there isn't a path we can just give Kodi to fill the list contents... (and I know I'm covering some ground you've already sorted, my apologies for that)

Define the widget in overrides.xml. Either via a <widget /> element...

Code:
<widget label="Weather Forecast" type="custom" path="$INCLUDE[weather-widget]">WeatherWidget</widget>

... or by adding a <shortcut /> element to the widget-groupings....

Code:
<shortcut label="Weather Forecast" widgetType="custom">$INCLUDE[weather-widget]</shortcut>

(These are both the absolute minimum needed, add other [widgetProperty] as needed.

So now when the template is built, $SKINSHORTCUTS[path] will be replaced with <include>weather-widget</include> for the weather widget. So the include should be the <item />'s that you want to use as the content of the list:-

Code:
    <include name="weather-widget">
        <item>
            <onclick>noop</onclick>
            <label>Now</label>
            <label2>$INFO[Window(Weather).Property(Current.Temperature)]$INFO[System.TemperatureUnits] ($INFO[Window(Weather).Property(Current.FeelsLike)]$INFO[System.TemperatureUnits])</label2>
            <icon>$VAR[weatherIcons]$INFO[Window(Weather).Property(Current.OutlookIcon)]</icon>
            <property name="weatherFanart">$INFO[Window(Weather).Property(Current.FanartCode)]</property>
        </item>
        <item>
            ...
        </item>
        <item>
            ...
        </item>
    </include>

And that's it. For widgets where Kodi can automatically fill the list, the template will be built with the <content /> set to the path so Kodi can do its stuff. And for weather, the template will be built with the <include /> - and therefore your manually-defined items - in the <content />.
Thanks Bob, that is the way I was trying to go about it. So I must be overlooking something silly... Smile
The only other things I can suggest (and others will have to fill in the details if it is this - it's not something I know a great deal about) but are you adding a fanart property to the static list (that is correctly returned with $INFO[ListItem.Art(Fanart)]) and/or do you have a weather fanart pack installed, now that they're image resource add-ons in Jarvis...?

For the record, I used to do something like the following in my template (I actually handle it differently now for various reasons), with the weather fanart pack selected via the available add-on, and the weather fanart code added as a separate property to the static list items:-

Code:
<property name="fanart" tag="property" attribute="name|widgetType" value="Weather">$INFO[Skin.String(weatherFanart.path)]$VAR[weatherFanart]$INFO[ListItem.Property(weatherFanart),,.jpg]</property>
<property name="fanart">$INFO[ListItem.Art(FanArt)]</property>

(Assuming a widgetType value of 'Weather')
(2015-12-04, 09:33)Jeroen Wrote: [ -> ]So I have been making some progress, thank you all for the help. I have my "normal" widgets actually showing up, even that feels like an achievement Rofl

I am still quite in the dark about how I can actually use

<content target="$SKINSHORTCUTS[target]">$SKINSHORTCUTS[path]</content>

for the regular widgets

and somehow substitute the path here for a regular include containing the static list content.

I have been switching back and forth between some of the methods posted here but it is quite overwhelming, I feel like I'm missing something totally obvious here.

I tried using an conditional include before the content tag and loads more but I'm afraid this is going to keep me busy for a while!

I had a similar issue when using static vs dynamic content way back with V2 of my widgets.

The issue is to do with how you define the content in the container, static vs dynamic.

This will work fine for dynamic content
Code:
<!-- Now insert the properties we pulled from the main menu -->
<content target="$SKINSHORTCUTS[target]">$SKINSHORTCUTS[path]</content>

But for Static content such as the weather widget you need to code it like this in place of the previous. Where path is the name of your include.
Code:
<!-- Now insert the properties we pulled from the main menu -->
<content>
<include>$SKINSHORTCUTS[path]</include>
</content>

And as Bob Mentioned your include (make sure not to use <content> tag in this)
Code:
<include name="weather-widget">
         <item>
             <onclick>noop</onclick>
             <label>Now</label>
             <label2>$INFO[Window(Weather).Property(Current.Temperature)]$INFO[System.TemperatureUnits] ($INFO[Window(Weather).Property(Current.FeelsLike)]$INFO[System.TemperatureUnits])</label2>
             <icon>$VAR[weatherIcons]$INFO[Window(Weather).Property(Current.OutlookIcon)]</icon>
             <property name="weatherFanart">$INFO[Window(Weather).Property(Current.FanartCode)]</property>
         </item>
         <item>
             ...
         </item>
         <item>
             ...
         </item>
     </include>

This should work if you make sure the path is set to the name of your weather widget includes in your overrides.
Code:
<widget label="Weather Forecast" type="custom" path="weather-widget">WeatherWidget</widget>
or for custom widget groupings
Code:
<shortcut label="Weather Forecast" widgetType="custom">weather-widget</shortcut>

You then could have two other includes such as <other include="widgetDynamic"> and <other include="widgetStatic"> in your templates. Then put some conditions in based on the widget type.

for static content
Code:
<condition tag="property" attribute="name|widgetType">custom</condition>

and for dynamic content
Code:
<condition tag="property" attribute="name|widgetType">otherwidgetType1</condition>
<condition tag="property" attribute="name|widgetType">otherwidgetType2</condition>
<condition tag="property" attribute="name|widgetType">otherwidgetType3</condition>
<match>any</match>
Thank you all for your help, it's appreciated.

I decided to press delete and start over and rewrite what I had so far because, based on your feedback, I was at least taking the correct approach. I am currently overhauling big blocks of code (not all skinshortcut related) in my skin, it becomes easy to overlook things when working on so many different things.

With results thankfully, as I now have one single container displaying dynamic and static content widgets Smile

One thing I noticed though, and this may have been the cause of problems in my earlier attempts too, is that it seems to matter where I place my include with the static content. When I got the weather widget working, my draft for the static list include was located in my includes.xml.

However my intention was to move this over to my IncludesHome.xml file. As soon as I moved it over, the widget stopped working. Even now, after cleaning up code and filling in the details it will only work when the include is in the includes.xml file. It doesn't bother me a whole lot, but it seems odd to me though?

Anyway, things are progressing nicely now Smile Thanks all for your awesome help. I'm sure I'll have some more questions later on Wink
(2015-12-04, 21:30)Mr. V Wrote: [ -> ]I had a similar issue when using static vs dynamic content way back with V2 of my widgets.

<snip />

Just so I fully understand, using $INCLUDE[IncludeName] as the widgetPath wasn't working for you for the script to insert the <include /> elements itself? If so - and I appreciate you've moved on from that method so at least the first may not be possible - but can you get me a debug log (wiki) and let me know which platform you're using as it should work, and I use it myself! Cheers Smile
So, I just noticed my submenus aren't showing the widget that is set to my main menu items even though I am using the clonewidgets build option. This is only happening with my vertical home menu, which uses one container for both the main and submenu items (link)

This happens regardless of whether the widget is set as a default.


Looks like the properties are being copied over though?:

PHP Code:
<item id="1">
    <
property name="id">$NUM[1]</property>
    <
label>$LOCALIZE[31013]</label>
    <
label2>Movies</label2>
    <
icon>DefaultIconWatchlist.png</icon>
    <
thumb />
    <
property name="labelID">31013</property>
    <
property name="defaultID">31013</property>
    <
onclick>ActivateWindow(Videos,plugin://script.watchlist?type=movies,return)</onclick>
    
<property name="path">ActivateWindow(Videos,plugin://script.watchlist?type=movies,return)</property>
    
<property name="list">plugin://script.watchlist?type=movies</property>
    
<visible>[StringCompare(System.ProfileName,Master user)] + StringCompare(Container(9000).ListItem.Property(submenuVisibility),movies)</visible>
    <
property name="group">movies</property>
    <
property name="widget">MoviesWatchlist</property>
    <
property name="widgetPath">plugin://script.watchlist/?type=movies</property>
    
<property name="widgetTarget">video</property>
    <
property name="widgetType">movies</property>
    <
property name="widgetName">Movies Watchlist</property>
    <
property name="isSubmenu">True</property>
</
item
Templates use the 'submenuVisibility' property to decide if they should display ... which aren't present in the submenu items in the single build mode. (Actually, I don't think they're present in any build mode, but you know what I mean!)

Can you please test https://github.com/BigNoid/script.skinsh...s/pull/119 - which adds them for the single build mode. Cheers.
Yup, had to restore shortcuts first but after that it's working, thanks!

And something I have been wondering. I have some ideas for an alternate homescreen. One where the widgets would actually take center stage over the menus so to speak. To achieve what I have in mind I would want to take any widget that has been assigned to a main menu item and display them all at once (so regardless of whether a widget's menu item is highlighted or not).

Am I right to assume this currently is not possible? And if so, is this something that could be considered?
You could probably get part of the way by just not including <skinshortcuts>visibility</skinshortcuts> in your widget template - all the widgets will be visible at once. Doing it this way you'd probably need a unique id for each list, which you might be able to get by pulling out the 'id' into a template property and using that as part of the list id. What I don't know how you'd do is manage navigation between the different widget lists.

Yes, I'm sure such a feature would be considered. For me to add it personally please be as specific as possible about what exactly you need adding to the script to do what you want (and the less that needs adding, the more likely I am to add it Wink - though I won't add any features until after the next repo push). For others to add it, it just needs to interest them Smile
(2015-12-05, 23:15)BobCratchett Wrote: [ -> ]
(2015-12-04, 21:30)Mr. V Wrote: [ -> ]I had a similar issue when using static vs dynamic content way back with V2 of my widgets.

<snip />

Just so I fully understand, using $INCLUDE[IncludeName] as the widgetPath wasn't working for you for the script to insert the <include /> elements itself? If so - and I appreciate you've moved on from that method so at least the first may not be possible - but can you get me a debug log (wiki) and let me know which platform you're using as it should work, and I use it myself! Cheers Smile

I have been looking further into this and no issues to report.

A lack of understanding on my part (still learning new stuff as I go along). I didn't think this would work as I had some issues way back with isengard static vs dynamic content and was looking over some old code;

So for static content I thought this was needed
Code:
<content>
<include>WeatherContent</include>
</content>

But this works fine
Code:
<content target=""><include>WeatherContent</include></content>

But it turns out I was wrong. As both examples do the same thing. I really cant say if it was an isengard issue or my lack of understanding at the time. But I have tested $INCLUDE and it is working fine and I have a shiny new weather widget working using static content Smile