how to add url for a listitem in XML (like xbmcplugin.addDirectoryItem)
#1
When using a python addon we can populate listitems and also add a url for each list item. This method allows us to create different URLs for each list item should be choose to do so.

I want to do something similar but inside a static Custom XML. i.e. I want each list item to have a different URL that gets called when user clicks on it.

So what is the equivalent of the command xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder) when done statically in an XML file.
Reply
#2
is the custom xml file part of your addon (ie. a python script that uses the WindowsXML class)
or a custom file you've added to the skin you're using?

in case it's the first, use the SetPath() function
if it's the latter, you need to define it inside <onclick></onclick>
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks Ronie.

I have not tried the first one, in my case it is a Custom XML file that I've created.

When you say define it inside the <onclick> </onclick> tags. Do you mean something like this:

<onclick>plugin://plugin.video.example?action=showThumbnails&category=albums&title=Wedding</onclick>

P.S. - I see you've responded to another thread I created. Both these threads I created today are meant to achieve the same goal but the approach is different.

The thing is when I use xbmcplugic to set URL inside xbmcplugin.addDirectoryItem() then each list item is able to fetch different results. Since fetching using plugin via webserver slows down the user experience, I wanted to have a combination of static Custom XML and dynamic content only where I must.

In a static custom XML when I add <onclick> with plugin for a listitem, it does not work.

<content target="1131">
    <item>
        <icon>image1.jpg</icon>
        <thumb>image1.jpg</thumb>
        <onclick>plugin://plugin.video.example/?action=showThumbnails&category=albums&title=Wedding</onclick>
   </item>
</content>

I see the following error in logs:

ERROR: Keymapping error: no such action 'plugin://plugin.video.example/?action=showthumbnails&category=albums&title=wedding' defined
Reply
#4
I think I know what the difference is - the python addon creates a Virtual folder and subfolders.

Is there a way to do that via python but referenced statically in Custom XML ?

To elaborate - When Kodi starts, can I run a script/addon that will create all the Virtual folders I want with dynamic content and give them names/special paths. And I just reference those names inside the custom XML that I write before hand.

The benefit of this would be to still have dynamic content available and updated everytime Kodi starts, having it run only once and be available when the user clicks an item that references it so it will be quick.

Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
how to add url for a listitem in XML (like xbmcplugin.addDirectoryItem)0