Kodi Community Forum

Full Version: Can somone give me an example addon.xml for Context Items?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello! I have wanted to make an Add-On for KODI. So I started out with an example. After I have got an Idea about what I'm going to make I started to add some menus. Without success. Well this is my addon.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.hello.world" name="Hello World" version="1.0.2" provider-name="zag">
    <requires>
        <import addon="xbmc.python" version="2.23.0"/>
    </requires>
    <extension point="xbmc.python.script" library="addon.py">
        <provides>executable</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary lang="en">Popup Hello World</summary>
        <description lang="en">Example Script to show Hello World</description>
        <license>GNU General Public License, v2</license>
        <language></language>
        <forum>http://forum.kodi.tv/showthread.php?tid=209948</forum>
        <source>https://github.com/zag2me/script.hello.world</source>
        <website>Kodi.tv</website>
        <email>zag@kodi.org</email>
        <assets>
            <icon>icon.png</icon>
            <fanart>fanart.jpg</fanart>
            <screenshot>resources/screenshot-01.jpg</screenshot>
            <screenshot>resources/screenshot-02.jpg</screenshot>
            <screenshot>resources/screenshot-03.jpg</screenshot>
        </assets>
        <news>Updated the addon to use new addon.xml metadata</news>
    </extension>
<extension point="kodi.context.item">
<menu id="kodi.core.main">
  <menu>
    <label>My submenu</label>
    <item library="contextitem1.py">
      <label>30001</label>
      <visible>true</visible>
    </item>
    <item library="contextitem2.py">
      <label>30002</label>
      <visible>true</visible>
    </item>
    <menu>
      <label>Subsubmenu</label>
      <item library="contextitem3.py">
        <label>30003</label>
        <visible>true</visible>
      </item>
    </menu>
</menu>
</extension>
</addon>
see the example in our wiki: https://kodi.wiki/view/Context_Item_Add-ons
(2020-07-09, 18:11)ronie Wrote: [ -> ]see the example in our wiki: https://kodi.wiki/view/Context_Item_Add-ons

Hi I said that I have already tried that  Sad I'm a bit confused about where to place all of this code... You can see my attempt in my post... Please help me.
(2020-07-09, 16:06)-Leocat Wrote: [ -> ]Hello! I have wanted to make an Add-On for KODI. So I started out with an example. After I have got an Idea about what I'm going to make I started to add some menus. Without success. Well this is my addon.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.hello.world" name="Hello World" version="1.0.2" provider-name="zag">
    <requires>
        <import addon="xbmc.python" version="2.23.0"/>
    </requires>
    <extension point="xbmc.python.script" library="addon.py">
        <provides>executable</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary lang="en">Popup Hello World</summary>
        <description lang="en">Example Script to show Hello World</description>
        <license>GNU General Public License, v2</license>
        <language></language>
        <forum>http://forum.kodi.tv/showthread.php?tid=209948</forum>
        <source>https://github.com/zag2me/script.hello.world</source>
        <website>Kodi.tv</website>
        <email>zag@kodi.org</email>
        <assets>
            <icon>icon.png</icon>
            <fanart>fanart.jpg</fanart>
            <screenshot>resources/screenshot-01.jpg</screenshot>
            <screenshot>resources/screenshot-02.jpg</screenshot>
            <screenshot>resources/screenshot-03.jpg</screenshot>
        </assets>
        <news>Updated the addon to use new addon.xml metadata</news>
    </extension>
<extension point="kodi.context.item">
<menu id="kodi.core.main">
  <menu>
    <label>My submenu</label>
    <item library="contextitem1.py">
      <label>30001</label>
      <visible>true</visible>
    </item>
    <item library="contextitem2.py">
      <label>30002</label>
      <visible>true</visible>
    </item>
    <menu>
      <label>Subsubmenu</label>
      <item library="contextitem3.py">
        <label>30003</label>
        <visible>true</visible>
      </item>
    </menu>
</menu>
</extension>
</addon>

I think you are just missing another "</menu>" tag at the end, you open 3 with the 1st one being the "<menu id="kodi.core.main">" but you only close the two submenus.

Im not sure if thats the only thing preventing it from working (for example the labels, im not sure if those are going to work or not) but with regard to adding a submenu that might get it working.
Thanks it works now!