Installing add-on programatically
#1
Question 
1. My plugin is dependent on other plugins. I want to give an option to user to select what all plugins to be installed. By specifying dependancy in <requires> tag in addon.xml will install other add-ons by default. Is there any way to install add-ons programmatically depending upon user's choice?

2. Is there any way to find out already installed add-on in a new plugin?
Reply
#2
1. No. Your choices are either to force the dependency or set to optional tag. There is no way to install add-ons programatically from the python side.

2. You can use xbmcaddon.Addon(id_of_addon) to grab info on an installed addon.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
jmarshall Wrote:1. No. Your choices are either to force the dependency or set to optional tag. There is no way to install add-ons programatically from the python side.

2. You can use xbmcaddon.Addon(id_of_addon) to grab info on an installed addon.

There has been a new option in dependencies.
You can now make it optional Smile

if you add "optional="true" to addon.xml and do something like
PHP Code:
setting label="30004" type="bool" id="trailer" default="false" enable="System.HasAddon(the plugin you want)" 
That addon will only be installed when the user will enable it

Relevant commits:
https://github.com/xbmc/xbmc/commit/bc73...88bdb4972c
https://github.com/xbmc/xbmc/commit/7e91...edc865e944
https://github.com/xbmc/xbmc/pull/652#is...nt-3610560
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
#4
Martijn Wrote:if you add "optional="true" to addon.xml and do something like
PHP Code:
setting label="30004" type="bool" id="trailer" default="false" enable="System.HasAddon(the plugin you want)" 
That addon will only be installed when the user will enable it

This works fine in Eden beta2. But value does not reflect if System.HasAddon(id) is used in default field
e.g. (youtube plugin is installed but vimeo is not)
PHP Code:
<setting id="youtube" type="bool" enable="System.HasAddon(plugin.video.youtube)" default="System.HasAddon(plugin.video.youtube)" label="31002"/>
        <
setting id="vimeo" type="bool" default="System.HasAddon(plugin.video.vimeo)" enable="System.HasAddon(plugin.video.vimeo)" label="31003"/> 

Both values are shown as false (unexpected) but only youtube one is enabled (expected).

also any workaround for Dharma/Eden beta1 just to test whether an addon has been installed or not?
Reply
#5
Don't think that logic makes sense.
You should choose if you want it default enabled or not when the add-on is installed
PHP Code:
<setting id="youtube" type="bool" enable="System.HasAddon(plugin.video.youtube)" default="true" label="31002"/>
<
setting id="vimeo" type="bool" enable="System.HasAddon(plugin.video.vimeo)"  default="true" label="31003"/> 

This should work also on Dharma and Eden before beta2 i think.
Only the optional dependency& install has been added to beta2 as far as i know.
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
#6
Martijn Wrote:This should work also on Dharma and Eden before beta2 i think.
Only the optional dependency& install has been added to beta2 as far as i know.

Tried this on dharma, both were disabled all the time.

In my case, if a plugin is not installed then video corresponding to that plugin should not be displayed. If I set default as true and if a setting is disabled, it is always returned as true in python. So I was wondering if I can set default based on plugin is installed or not. Below are different scenarios

1. Setting is disabled but default is set to true
2. Setting is enabled. Default is true and user set/reset it to true
3. Setting is enabled. Default is true and user change the value to false

If a setting is disabled then its value is still true, I want to distinguish this case from case2 (where true is set/reset by user). In case one, setting value is to be ignored.

Alternate is to find out whether property is disabled. If disabled, ignore that setting value and use setting value only if setting is enabled. Posted another thread for this.
Reply

Logout Mark Read Team Forum Stats Members Help
Installing add-on programatically0