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.
Still getting the same error trying to build the menus.

removed151214

Do you still have defaults in the old .shortcuts format? Assuming it's the same error (it'll be being called slightly differently after the revert at the very least, the error is saying it can't load them. That means either the script is incorrectly calling this function when it doesn't have a .shortcuts file to upgrade, or the .shortcuts file is invalid.
Found the problem, I'd deleted the script-skinshortcuts-includes.xml but the visible conditions aren't getting added from the mainmenu.DATA.xml.

removed151214

You're not overriding the action are you...? (The only situation which should stop the visible condition being added.) I've tried it and had it working from the script defaults, the skin defaults and by manually editing the users mainmenu.DATA.xml with the following:

Code:
    <shortcut>
        <label>342</label>
        <label2>Common Shortcut</label2>
        <icon>DefaultMovies.png</icon>
        <thumb />
        <action>ActivateWindow(Videos,MovieTitles,return)</action>
        <visible>False</visible>
    </shortcut>

(You say "conditions" - the script is only set up to retrieve a single visible condition from the data files)

Edit: Except, of course, that the visible property won't be saved when editing a menu. Gah, that was a silly thing to overlook on my part. I'm about to eat, but will fix that afterwards.
No overrides.

mainmenu.DATA.xml

PHP Code:
<shortcuts>
    <
shortcut>
        <
label>YouTube</label>
        <
label2>Common Shortcut</label2>
        <
defaultID>plugin.video.youtube</defaultID>
        <
icon>special://home/addons/plugin.video.youtube/icon.png</icon>
        
<thumb />
        <
action>ActivateWindow(10025,"plugin://plugin.video.youtube",return)</action>
        <
visible>System.HasAddon(plugin.video.youtube)</visible>
    </
shortcut>
    <
shortcut>
        <
label>Trailers</label>
        <
label2>Common Shortcut</label2>
        <
defaultID>plugin.video.itunes_trailers</defaultID>
        <
icon>special://home/addons/plugin.video.itunes_trailers/icon.png</icon>
        
<thumb />
        <
action>ActivateWindow(10025,"plugin://plugin.video.itunes_trailers",return)</action>
        <
visible>System.HasAddon(plugin.video.itunes_trailers)</visible>
    </
shortcut>
    <
shortcut>
        <
label>TWiT</label>
        <
label2>Music Add-On</label2>
        <
defaultID>plugin.video.twit</defaultID>
        <
icon>special://home/addons/plugin.video.twit/icon.png</icon>
        
<thumb />
        <
action>ActivateWindow(10501,"plugin://plugin.video.twit",return)</action>
        <
visible>System.HasAddon(plugin.video.twit)</visible>
    </
shortcut>
</
shortcuts

script-skinshortcuts-includes.xml

PHP Code:
<item id="9">
    <
label>YouTube</label>
    <
label2>Common Shortcut</label2>
    <
icon>special://home/addons/plugin.video.youtube/icon.png</icon>
    
<thumb />
    <
property name="labelID">plugin.video.youtube</property>
    <
property name="defaultID">plugin.video.youtube</property>
    <
onclick>ActivateWindow(10025,"plugin://plugin.video.youtube",return)</onclick>
    <
visible>StringCompare(System.ProfileName,Master user)</visible>
    <
property name="submenuVisibility">plugin-video-youtube</property>
    <
property name="group">mainmenu</property>
    <
property name="hasSubmenu">True</property>
</
item>
<
item id="10">
    <
label>Trailers</label>
    <
label2>Common Shortcut</label2>
    <
icon>special://home/addons/plugin.video.itunes_trailers/icon.png</icon>
    
<thumb />
    <
property name="labelID">plugin.video.itunes_trailers</property>
    <
property name="defaultID">plugin.video.itunes_trailers</property>
    <
onclick>ActivateWindow(10025,"plugin://plugin.video.itunes_trailers",return)</onclick>
    <
visible>StringCompare(System.ProfileName,Master user)</visible>
    <
property name="submenuVisibility">plugin-video-itunes-trailers</property>
    <
property name="group">mainmenu</property>
</
item>
<
item id="11">
    <
label>TWiT</label>
    <
label2>Music Add-On</label2>
    <
icon>special://home/addons/plugin.video.twit/icon.png</icon>
    
<thumb />
    <
property name="labelID">plugin.video.twit</property>
    <
property name="defaultID">plugin.video.twit</property>
    <
onclick>ActivateWindow(10501,"plugin://plugin.video.twit",return)</onclick>
    <
visible>StringCompare(System.ProfileName,Master user)</visible>
    <
property name="submenuVisibility">plugin-video-twit</property>
    <
property name="group">mainmenu</property>
</
item

removed151214

Chicken was still pink, so I've fixed it so the visibility property actually gets saved when editing the menus. Hopefully, after you reset your menus, this should all work as intended. (Fingers crossed!)
OK, everything is working with the visible condition getting added for one but I'm getting this error trying to reset another that's still got the old shortcut files. Undecided

Code:
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.SyntaxError'>
Error Contents: ('unexpected EOF while parsing', ('<string>', 0, 0, ''))
Traceback (most recent call last):
File "C:\Users\Kevin\AppData\Roaming\XBMC\addons\script.skinshortcuts\resources\lib\gui.py", line 1392, in onAction
self._save_shortcuts()
File "C:\Users\Kevin\AppData\Roaming\XBMC\addons\script.skinshortcuts\resources\lib\gui.py", line 493, in _save_shortcuts
datafunctions.UpgradeFunctions().upgrade_file( target )
File "C:\Users\Kevin\AppData\Roaming\XBMC\addons\script.skinshortcuts\resources\lib\datafunctions.py", line 807, in upgrade_file
shortcuts = eval( list )
SyntaxError: ('unexpected EOF while parsing', ('<string>', 0, 0, ''))
-->End of Python script error report<--

removed151214

I was passing the wrong file name to the upgrade function Blush Hopefully it's now fixed on git.

And thanks so much for taking the time to help track down these bugs. You never know, thanks to yourself and others, this might actually be the first time the script gets updated on the repo without a showstopper!
Success! Laugh

No need to thank me you're doing all the work. Wink
I use the script only for the submenus and i am using .shortcuts files.
Is it possible to add visible conditions by default there ?. For example in TV Shows submenu the TV Guide entry (RunAddon(script.tv.show.next.aired,return) is still visible even if the library is empty.

Also i noticed that if the Music Library is empty the default submenu's library entry's (Albums, Artists etc) are hidden (which is correct) but, when the Video Library is empty the Movies/TV Shows default submenu's library entry's (Genres, Actors etc) are still visible which is not useful because they lead to empty screens.

By the way thanks for all the work that you put on this script and i can see now that is... huge !

Cheers
Nessus

removed151214

(2014-08-11, 21:02)nessus Wrote: [ -> ]I use the script only for the submenus and i am using .shortcuts files.
Is it possible to add visible conditions by default there ?. For example in TV Shows submenu the TV Guide entry (RunAddon(script.tv.show.next.aired,return) is still visible even if the library is empty.

Sorry, not possible with the .shortcuts files. The file format is simply too rigid to be able to add, well, anything to it (hence the change to xml). If it helps, I'm about given up waiting for translations to be updated from Transifex, so I'm going to run some stress tests and get the new version (with the xml file format) submitted to the repo sooner rather than later.

(2014-08-11, 21:02)nessus Wrote: [ -> ]Also i noticed that if the Music Library is empty the default submenu's library entry's (Albums, Artists etc) are hidden (which is correct) but, when the Video Library is empty the Movies/TV Shows default submenu's library entry's (Genres, Actors etc) are still visible which is not useful because they lead to empty screens.

Nice spot. Should now be fixed on git.

(2014-08-11, 21:02)nessus Wrote: [ -> ]By the way thanks for all the work that you put on this script and i can see now that is... huge !

You're welcome Smile
Well, i guess will have to switch to xml files then. Is there an easy way to convert my existing .shortcuts files to xml DATA ?
If i switch to DATA xml file do i need an override.xml file for the script to work or that still optional ?


Cheers
Nessus

removed151214

Stick 'em into the scripts folder under addon_data. If you've already run a git version with the xml data store, delete settings.xml from same directory or (easiest under Helix, where the script appears in system > add-ons) deselect everthing from the "Upgrading" tab of the scripts settings.

Next time the script runs, it will updrage any .shortcuts in its addon_data folder to the xml format. They may need some minor editing - for example, skin-provided labels will be in specific format used to persist them across skins when they only need to be the id, and a defaultID should have been added to items, which has no function when the files are copied back to the skins shortcuts directory.

The overrides.xml is still optional.
Great. Will download the latest git version and try it out.

Thanks a lot.

Cheers
Nessus
(2014-08-11, 21:37)Unfledged Wrote: [ -> ]If it helps, I'm about given up waiting for translations to be updated from Transifex, so I'm going to run some stress tests and get the new version (with the xml file format) submitted to the repo sooner rather than later.

Thank goodness for that, I've just realised I submitted Conq to the official repo with version 0.4.0 as a requirement! Rolleyes