1

I am contributing to the Kodi PartyMode AutoStart add-on.

I would like to add the option to manually trigger the plugin using Kodi's existing "Run" button for add-ons (which is disabled at the moment), so that users can test their settings without having to reboot the device.

I assume that the button is disabled because the add-on is a Service add-on, which are designed to run (per Kodi documentation) at startup or upon login.

My question: is there something I can set in the .py or settings file to enable this Run button, and trigger the plugin, or would I need to change the entire add-on type?

Screenshot

Eric Lindsey
  • 954
  • 8
  • 19
  • you can follow answer suggested by @Razze but for only testing purpose you can create your own executable addon to run your script with `RunScript()` – Gahan Dec 08 '17 at 07:07
  • @Gahan that is not really an option, because I want the Run button to work so that _end users_ can easily test their settings. – Eric Lindsey Dec 08 '17 at 16:15
  • The GUI decides whether to enable the Run button (which is called Select in the source code) based on the output of several functions, one of which is [CanRun()](https://github.com/xbmc/xbmc/blob/master/xbmc/addons/GUIDialogAddonInfo.cpp#L378). It will return true if `m_localAddon` is non-null and of type `ADDON_SCRIPT`, so I don't see why the button would be disabled in my case. – Eric Lindsey Dec 08 '17 at 16:17

1 Answers1

1

You can define multiple extension points in your addon.xml so your service can also have a script extension point and act on that. So you would have both these.

<extension point="xbmc.python.script" library="defaultscript.py">
    <provides>executable</provides>
</extension>

See: https://github.com/trakt/script.trakt/blob/master/addon.xml#L10-L13

Razze
  • 4,124
  • 3
  • 16
  • 23
  • This script already has that extension point, and still no Run button is enabled. See here: https://github.com/elbowz/partymode-autostart-xbmc-service/blob/master/addon.xml#L11-L13 – Eric Lindsey Dec 08 '17 at 00:42
  • It seems that that extension point is activated by the "Configure" button, not the "Run" button as shown in the screen shot above. – Eric Lindsey Dec 08 '17 at 02:44