How do I have my python check if an addon is installed
#1
I have an addon that computes some settings for another addon. I'd like to be able to warn the user if the target addon isn't installed. How can I safely check if an addon is installed. I've seen the System.HasAddon() call but that doesn;t seem to be available to a Python script (or is it?) - leastways, I have no idea how to call it.

I'm sure it must be possible, but I can't for the life of me work it out.
Reply
#2
http://mirrors.xbmc.org/docs/python-docs...Visibility
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
or try
addon = xbmcaddon.Addon("script.xxx")
It probably either throws an exception when not available or addon becomes None.
Didnt test though.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#4
Code:
def script_chk(script_name):
return xbmc.getCondVisibility('System.HasAddon(%s)' % script_name) == 1

this is what i use, it returns bool
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#5
(2016-03-16, 00:02)Lunatixz Wrote:
Code:
def script_chk(script_name):
return xbmc.getCondVisibility('System.HasAddon(%s)' % script_name) == 1

this is what i use, it returns bool

you can drop the "== 1" from that expression.
EDIT: oh, didnt know that, according to docs it really returns 1 and 0.
Shouldnt matter for most python coding styles though.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#6
I'd suggest JSON-RPC call for installed Addons as alternative
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#7
Thumbs Up 
Thanks to all for the help. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
How do I have my python check if an addon is installed0