Open matthuisman opened 1 year ago
Does a separate add-on instance have a separate addon_data folder?
What is the use case for different settings for multiple instances?
as far as I can tell, all instances use the same addon_data folder.
Only difference seems to be with settings xml.
settings.xml instance_1.xml instance_2.xml
Use case I've seen is with multiple instances of PVR Simple Client so you can have multiple playlists / epg sources.
ideally, we should be able to
1) get all instance ids 2) loop each instance and get its name and various settings 3) create a new instance 4) set / get instance settings
There needs to be a way to get/set both add-on settings and instance settings.
It’s not the case with pvr.iptvsimple
but other PVR add-ons such as pvr.vuplus
and pvr.hts
have settings that apply to everyone instance as well as individual settings.
Likely we also need a supports instance settings function to be able to differentiate between pvr add-ons that do/don’t support the feature
Does a separate add-on instance have a separate addon_data folder?
What is the use case for different settings for multiple instances?
Another use case. I have two TVs in my house, and each has a PVR device. I should be able to connect to both from one kodi device.
I propose the python api follows the internal api
`addon = xbmcaddon.Addon('pvr.iptvsimple')
global = addon.getSetting('foo') instance_1 = addon.getSetting('foo', 1) instance_2 = addon.getSetting('foo', 2) (as well as the getInt, getBool etc)
addon.setSetting('bar', 'value') addon.setSetting('bar', 'value', 1) addon.setSetting('bar', 'value', 2) ` This would be a good start :)
An alternative would be to leave getSetting()
for the add-on settings and then something like getInstanceSetting()
for instance settings. This would make it clear and distinct.
That way existing behaviour does not need to change and the API change is purely additive, leaving the current API functions unchanged. Remember that instance settings are only for PVR add-ons currently as far as I'm aware.
WDYT?
+1 to this, my python addon also was modifying pvr iptvsimple settings to auto configure the hls streams. Noe it is just setting settings.xml instead of the instance.
@enen92 do you have a preference between over loading the existing getSettings
calls or using a separate getInstanceSettings()
set of calls?
Personally I'd prefer an overload but without any strong feelings. InstanceSettings might be a bit confusing for newcomers (even for me, I was not even aware of multi instance addons).
I propose the python api follows the internal api
`addon = xbmcaddon.Addon('pvr.iptvsimple')
global = addon.getSetting('foo') instance_1 = addon.getSetting('foo', 1) instance_2 = addon.getSetting('foo', 2) (as well as the getInt, getBool etc)
addon.setSetting('bar', 'value') addon.setSetting('bar', 'value', 1) addon.setSetting('bar', 'value', 2) ` This would be a good start :)
Ok Matt, your suggestion is the winner 😉
This issue is now marked stale because it has been open over a year without activity. Remove the stale label or add a comment to reset the stale state.
Ping
Pong?
Looks like the new addon api can take a new argument for the instance ID and it defaults to the add-ons id (settings.xml).
Python API needs to be updated to allow getting a list of the instance ids and then accessing there settings.
addon.getSetting('setting_name', instance_id) ?