v15 Handling context menu items
#1
Hey everybody,

I'm trying to understand this wiki at the moment.
http://kodi.wiki/view/Context_Item_Add-ons

My problem specifically is that I have two context extension points, so how do I know which one was clicked? Or do I need to route each of them to a different file to achive this?

Thanks
Reply
#2
I assume you meant adding multiple <item> definitions. If you do that only the first one will register. It's not possible to have more than one item, so there is no such ambiguousness.
Reply
#3
(2015-05-18, 22:04)takoi Wrote: I assume you meant adding multiple <item> definitions. If you do that only the first one will register. It's not possible to have more than one item, so there is no such ambiguousness.

So I need to split it up into two other addons and add them as dependencies like phil did here?
https://github.com/phil65/context.extend....ratemedia
https://github.com/phil65/context.extendedinfo.dialog

Seems a bit complicated

edit:

This is working as far as I can tell:

Code:
<extension point="kodi.context.item" library="test.py">
      <item>
        <label>32138</label>
        <visible>StringCompare(ListItem.dbtype,movie) | StringCompare(ListItem.dbtype,tvshow) | StringCompare(ListItem.dbtype,season) | StringCompare(ListItem.dbtype,episode)</visible>
      </item>
    </extension>
    <extension point="kodi.context.item" library="test2.py">
      <item>
        <label>32140</label>
        <visible>StringCompare(ListItem.dbtype,movie) | StringCompare(ListItem.dbtype,tvshow) | StringCompare(ListItem.dbtype,season) | StringCompare(ListItem.dbtype,episode)</visible>
      </item>
    </extension>

If you have to solve it this is what I ended up with:
https://github.com/Razzeee/script.trakt/...301a5d46bc
Reply
#4
If that works, that would be a bug. Definitely not supported behavior to have multiple extension point of the same type. I'm guessing something internally makes it appear as two separate addons. You know, supporting multiple items was deliberately postponed precisely because of this and the lack of customizability: when you add two items you force those items into everyone's context menu of everyone using the trakt addon. The way you implemented them, they are already two independent script from the main addons so why is splitting them 'complicated'?
Reply
#5
(2015-05-19, 19:44)takoi Wrote: If that works, that would be a bug. Definitely not supported behavior to have multiple extension point of the same type. I'm guessing something internally makes it appear as two separate addons. You know, supporting multiple items was deliberately postponed precisely because of this and the lack of customizability: when you add two items you force those items into everyone's context menu of everyone using the trakt addon. The way you implemented them, they are already two independent script from the main addons so why is splitting them 'complicated'?

Well I figured this shouldn't work by design, but that makes it much more interesting Wink

Splitting them is not complicated I just thought it wouldn't be the prefered way. I can imagine the context menu repo getting confusing and bloated up in like no time.
Reply
#6
(2015-05-19, 21:05)Razze Wrote: Well I figured this shouldn't work by design, but that makes it much more interesting Wink

Splitting them is not complicated I just thought it wouldn't be the prefered way. I can imagine the context menu repo getting confusing and bloated up in like no time.
Yeah, that's another problemSmile I don't want to 'recommend' any preferred way. Do what you think is best. Currently there's so few addons extending the context menu that none are a problem. Only time will tell how abused it will be. Ideally the menu would be editable by user, and add-ons would be able to add their own top level groups (so they could have as many sub-items as they want) but that's something for the future.
Reply
#7
For reference I ended up with these two

https://github.com/Razzeee/context.trakt.watched
https://github.com/Razzeee/context.trakt.rate
Reply

Logout Mark Read Team Forum Stats Members Help
Handling context menu items0