How to Enable one addon from another

  • Hi there!


    I posted this on the Kodi forums but apparently this is a banned topic because it enables you to bypass a Kodi security feature or something... So I'm posting here :-)


    I am wondering if there is python code that will allow me to enable one addon, from another. The addon I am trying to enable has been installed properly, using the add-on installer in Kodi, but has been disabled.

    I have 6 devices running Kodi 17.4 using LibreElec 8.2 (Windows x86/Android TV/Pi) at 4 locations, and I access them via SSH. I can remote in and try to enable the addon remotely, but it would be far better if I could get my one addon to check on the statuys of the other addon upon start. And if it is disabled, enable it. :-)

    I have 2 addons; pluging.video.testaddon & plugin.video.demoaddon

    In order for pluging.video.testaddon to work, plugin.video.demoaddon bust be enabled. plugin.video.demoaddon gets disabled when the system updates (LibreElec updates). If I go into addons and enable it, it works fine, but I am not local t these machines and I cannot do that. It is nearly impossible for be to walk the elderly folks, who are using the devices, through enabling the addons lol.

    So I need pluging.video.testaddon, when it starts up, to check if plugin.video.demoaddon is enabled. If not, it needs to enable it.

    Is this possible?

    I have searched and found the following thread (https://forum.kodi.tv/showthread.php?tid...able+addon), which suggests the following format:

    import xbmc

    xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "plugin.video.demoaddon ", "enabled": false }}')


    I have added this line into startup.py in pluging.video.testaddon, but had no luck so far.


    Thanks so much for your time!!

    Ken

  • If it is banned at the Kodi forums, what makes you think it is allowed here?


    Besides, the code you posted seems to be to disable it - setting enabled to false.

  • Hey nick!


    Lol, well I am not really interested in discussing Banned topics and ruffling feathers, but since this is not related to a banned addon etc, I thought maybe the talented devs here would be interested in discussing it without invoking the wrath of Kodi :-)


    Since I have no idea what 'security feature' this would circumvent, my question was not made in malice.


    If this is also a banned topic here, then so beit. However, if not, my question stands.


    You do make a good point, it does say false! I believe that is a typo on my part, but will test the code to be sure.


    Cheers,

    Ken

  • You have extra space character in your addon id. Maybe that's the problem (well, not maybe but very probably).

    Code
    1. "addonid": "plugin.video.demoaddon "


    And you can try to disable from command line. And you will also get some feedback.

    Code
    1. curl -d '{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","params":{"addonid":"plugin.video.demoaddon","enabled":true},"id":1}' -H 'Content-Type: application/json' http://localhost:8080/jsonrpc

    I'm using such code but it is at home. Try it and I will double check later today.


    Update: Actually I found it on Dropbox too. And it is the same as above. And it works fine.

    Done giving support here because of last events.

  • kenmills I think if you want it to be, your thread on kodi forums will be reinstated, let me know. (premature comment, mods have now discussed).

  • Thanks nickr and vpeter!


    Looks like my thread on Kodi is fine and the info is sound. I will test tonight.


    CHEERS!

    Ken