• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 140
Release script.skinshortcuts
#16
(2013-12-05, 00:09)BigNoid Wrote: Works a treat, thx.
If anyone wants to test, make a shortcuts folder in your skin directory, put a file the with extension .db and fill it with syntax like this:
Code:
[['Put your label1 here', 'Put your Label2 here', 'Put your Icon here', 'Put your Thumbnail image here', 'ActivateWindow(Weather)'],
[xbmc.getLocalizedString(31951), 'Label2', 'special://skin/backgrounds/pictures/default.jpg', xbmc.getInfoLabel('Skin.String(CustomPicturesBg)'), 'ActivateWindow(Pictures)']]

Been thinking about this example some more, and realised that this wouldn't work if the user switched to another skin using skinshortcuts as it uses a string specific to the current skin - the shortcut would still load, but it would be labelled whatever that skin has assigned to the string 31951 (or possibly, wouldn't have a label at all).

A quick fix would be to use one of the strings supplied by XBMC (and therefore available to all skins) - if the label is meant to be 'Pictures', for example, then (and I haven't tested this) it could use xbmc.getLocalizedString(1). However, if it's providing something which only works with the current skin, I need to think of a way for skins to provide shortcuts which won't carry over to other skins.
Reply
#17
I was considering main menu items - videos, movies, tv shows...

Of course problem is how to manage and mix built-in items with a custom ones as BigNoid said. Submenu items are story for itself as you can have DB filters (genres, years) along with built-in functions like settings or update library there.

@devs
It would be best if your initiative would get support from the team so that links user have made are available across all skins and probably kept in a manually editable format such as XML http://wiki.xbmc.org/index.php?title=Custom_video_nodes

Anyhow I really appreciate the work you're putting in this.
My skins:

Amber
Quartz

Reply
#18
BigNoid has just added the ability for users to change the label, icon, thumbnail and action - so users can now define completely custom shortcuts.

Skinners now need to provide four additional buttons:
305 - change label
306 - change icon
307 - change thumbnail
308 - change action

Actions can be pretty much any XBMC function. So to go to pictures
Code:
ActivateWindow(pictures)
to update library
Code:
UpdateLibrary(video)
and so on.
Reply
#19
Just to show the possibilities for a fully customizable home screen with unlimited custom items, each with individual custom submenus by making use of this script:
- add a button in script-skinshortcuts.xml
Code:
                <control type="button">
                    <description>Set submenu Button</description>
                    <width>310</width>
                    <align>center</align>
                    <font>font15</font>
                    <label>Set Submenu</label>
                    <onclick>$VAR[SetSubMenuVar]</onclick>
                </control>

- add the variable:
Code:
    <variable name="SetSubMenuVar">
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31951])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_pictures)</value>
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31952])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_pvr)</value>
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31953])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_videos)</value>
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31954])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_movies)</value>
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31955])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_tvshows)</value>
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31956])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_music)</value>
        <value condition="StringCompare(Container(211).ListItem.Label,$LOCALIZE[31959])">RunScript(script.skinshortcuts,type=manage&amp;group=nox_settings)</value>
        <value>RunScript(script.skinshortcuts,type=manage&amp;group=nox_$INFO[Container(211).ListItem.Label])</value>
    </variable>
- load content:
Code:
<content>$VAR[SubMenuVar]</content>
- add variable:
Code:
    <variable name="SubMenuVar">
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31951])">plugin://script.skinshortcuts?type=list&amp;group=nox_pictures</value>
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31952])">plugin://script.skinshortcuts?type=list&amp;group=nox_pvr</value>
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31953])">plugin://script.skinshortcuts?type=list&amp;group=nox_videos</value>
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31954])">plugin://script.skinshortcuts?type=list&amp;group=nox_movies</value>
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31955])">plugin://script.skinshortcuts?type=list&amp;group=nox_tvshows</value>
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31956])">plugin://script.skinshortcuts?type=list&amp;group=nox_music</value>
        <value condition="StringCompare(Container(9000).ListItem.Label,$LOCALIZE[31959])">plugin://script.skinshortcuts?type=list&amp;group=nox_settings</value>
        <value>plugin://script.skinshortcuts?type=list&amp;group=nox_$INFO[Container(9000).ListItem.Label]</value>
    </variable>

Where Container(9000) is my Home menu list id and the preset items are default submenus provided by the skin. All this can be re-ordered and such while the submenus stay with the appointed home menu item.

Now, why anybody would want a Home menu with more then 10 items is beyond me, but fact is there's a demand for it and now it can be done with just a few lines of code Big Grin
Reply
#20
Very nice guys. Thanks!
My skins:

Amber
Quartz

Reply
#21
btw - there where plans to have a unified user customizable home menu accross skins using this new feature (if skin decides to support it), but for v14 as time was running out for Gotham. If this script is now jumping in to achieve this, that's fine as well I think Smile
Reply
#22
I would ask if skins could try to ALL use the same menus (as much as possible) so if users switch skins they keep the same menus Smile
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#23
Thats possible. Every skin that uses this script should run the main menu with this code:
Code:
plugin://script.skinshortcuts?type=list&amp;group=mainmenu

For custom submenus, just set and load the group with the label of the custom menu:
Code:
RunScript(script.skinshortcuts,type=manage&amp;group=$INFO[Container(211).ListItem.Label])

Code:
<content>plugin://script.skinshortcuts?type=list&amp;group=$INFO[Container(9000).ListItem.Label]</content>
Reply
#24
If we're talking about using this script to generate the main menu items, as well as the shortcuts for those items then it's doable but there's a few problems will need to be overcome first.

Firstly, it'd probably need another group of shortcuts for the standard main menu items (videos, movies, weather, etc) along with a new set of defaults. That's easy enough, though I'd prefer to wait until I've improved the localization support (my project for the weekend) before that gets added.

More difficult (actually probably easy enough, I just don't know Python well enough yet!) the script would have to check whether, for example, the user has PVR support enabled, and only show a PVR main menu item if it is. This also has the potential to lead to some very messy code.

Finally is the speed at which the list can be populated - there's already a pause before submenu shortcuts are displayed. Now I don't think that's a particular issue for shortcuts - people are likely willing to wait a second for them to appear. However, the same pause before the main menu items appear could be problematic.
Reply
#25
Been playing with Home menus today and the delay doesn't seem to bad, but as you say there needs to be more support for xbmc commandes eg "settings" and other plugins like running Cinema Experience from the main menu. Also have a problem with the "Custom Action" as in some cases the input needed for the command is too long. I think the ability to reset the menu back to the skins preferred defaults when required is also needed.
Noli illegitimi carborundum


Reply
#26
Adding support for things like cinema experience is where things could get really messy - having to check if the plugin is installed and the user has it enabled (a skin setting which can change between skins.) Once I've sorted out the localization stuff I'll have a think to see if there's an easy way to do this. (It may be possible to allow the skin to override certain actions - so if the action is to go to the movie library, the skin can tell the script to run cinema experience instead.)

Not sure what can be done about the input being too short for custom actions. It's using the standard XBMC keyboard - if that has a limit, the the input has a limit.

Once the localization stuff is sorted I'm going to update how the script manages defaults when the skin doesn't provide any. After that, I'll add a reset button. Smile
Reply
#27
I currently use includes to avoid loading the bulk of the 120 items in my main menu list. I load perhaps 30 of them per window, 20 of which sub-menu items (items that are in the same list, recognized by a property). The main menu also serves as the (hidden) left sideblade from confluence and is available everywhere. Even if support for properties was added, that would be way too many items to load and stringcompare. Or am i missing something?
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#28
(2013-12-06, 22:55)MassIV Wrote: I currently use includes to avoid loading the bulk of the 120 items in my main menu list. I load perhaps 30 of them per window, 20 of which sub-menu items (items that are in the same list, recognized by a property). The main menu also serves as the (hidden) left sideblade from confluence and is available everywhere. Even if support for properties was added, that would be way too many items to load and stringcompare. Or am i missing something?

If I'm understanding you right, your skin shows main menu and submenu items in a single list - that's not something that's going to be supported by this script. Limitations of the new Gotham way of filling a list mean it will require each [groupname] to use a separate list.
Reply
#29
I've pushed an update to git with improved localization support and, because there seems to be some interest in it, some updates for using the script to provide the main menu, as opposed to just the submenus (though it'll still take a skilled skinner to pull it together!)

For localization, the script now stores the string id rather than the localized string. This means that if the user switches languages, any shortcuts with localized labels will switch language too. If you want to use a localized string in a skin defaults file then use the format "::LOCAL::id" - so for 'Pictures' you could use "::LOCAL::10002", for example.

Now, for using the script to manage the whole menu...

Firstly, there's a new action for your skinsettings.xml file - the script can fill a list within that page with links to choose main menu items([groupname] - mainmenu), and individual links to set shortcuts for each main menu item. Just use
Code:
<content>plugin://script.skinshortcuts?type=settings&amp;property=$INFO[Window(10000).Property("skinshortcuts")]</content>

Next, I've added a new group of shortcuts I've termed 'Common' for things users are likely to want on the main menu.

Finally, because menu items are localized whenever possible, it doesn't seem wise to rely on $INFO[lisitem.label] for choosing the [groupname] of shortcuts as has been previously suggested, as it will change between languages, so I've added a new property to the listitems - labelID.

For common main menu items, this will contain a non-localized string (videos, movies, tvshows, livetv, music, musicvideos, pictures, weather, programs, settings). For other localized strings, it will return the string id (e.g. for 'Profiles' the $INFO[listitem.property(labelID)] will be "13200"). For non-localized string, it will return the string minus any spaces.

You can check this property to decide whether to display, for example, a list of recently added movies, and you should also use this labelID for the naming of any default files the skin provides. Finally, the labelID should be used as the [groupname] to list any shortcuts for the menu item.

Edit: I've pushed another update allowing skinners to override actions by providing an overrides.xml file - it could be used to override going to Movie Titles and run Cinema Experience instead, for example. See the readme file included with the script for full details.

Hope all of that's clear. Let me know how you get on!
Reply
#30
Quick note to say an initial release is now available on the repository, and hopefully on Transifex soon. Simple details of how to use are in the first post, with full details (including details of using the script to provide both main menu and sub-menus) in the scripts included readme.txt. Updates upcoming include speed improvements (I got a Raspberry Pi from Santa and will make it work as well as possible on this device as I can) as well as - when providing the whole home page menu - the option to list all menu items with custom links (to provide, for example, for example, custom widgets, for main menu items.)

I'd love to hear how it works for you, and any missing features that I really should add!
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 140

Logout Mark Read Team Forum Stats Members Help
script.skinshortcuts8