I'm creating an addon for Kodi in python, and I need to create a link to open another addon that, if not installed but present in one of the repositories, Kodi will ask the user and install and open the addon. I've seen this before on youtube and sports devil links. If not present but in the repo, Kodi asked if you want to install it. This is about Python, NOT the "import" in addon.xml. Can anyone help?
Kodi python - how to call another addon and, if not installed but present in repo, ask to install it
Asked
Active
Viewed 1,716 times
2 Answers
1
I ended up doing this:
import xbmc, xbmcaddon, xbmcgui, xbmcplugin
import os
import time
def installOPENaddon(IDdoADDON):
pathTOaddon = os.path.join(xbmc.translatePath('special://home/addons'), IDdoADDON)
if not os.path.exists(pathTOaddon)==True:
xbmc.executebuiltin('InstallAddon(%s)' % (IDdoADDON))
xbmc.executebuiltin('SendClick(11)'), time.sleep(2), xbmcgui.Dialog().ok("Add-on Install", "The addon was not present. Please wait for installation to finish.")
else:
pass
if os.path.exists(pathTOaddon)==True:
xbmc.executebuiltin('RunAddon(%s)' % (IDdoADDON))
else:
xbmcgui.Dialog().ok("Add-on Error", "Could not install or open add-on. Please try again...")
installOPENaddon("my.addon.id")

pingul
- 3,351
- 3
- 25
- 43
1
If you want to do it in a skin xml you can do this:
<onclick condition="!System.hasAddon(plugin.video.youtube)">InstallAddon(plugin.video.youtube)</onclick>

Razze
- 4,124
- 3
- 16
- 23
-
Thank's. I didn't know it was possible whit xml. I'm also interested in it because of the skin I'm working on. Arroud xml, I'm looking for a solution to create a list of "send clicks" to toggle RSS ON and OFF. I want to create a button for that in the home screen. I've been searching for weeks with the window id method but with no luck.Can't find a window id for that. Maybe, the solution is arround a send click sequence to navigate to the setting... Do you know something about this? – Gabriel Coutinho De Miranda Sep 13 '17 at 00:38
-
Not possible afaik. You could only open the settings and directly go to the section. – Razze Sep 13 '17 at 09:34