Anyone else finding the new settings class unreliable? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Anyone else finding the new settings class unreliable? (/showthread.php?tid=375038) |
Anyone else finding the new settings class unreliable? - SEIKT - 2023-11-14 There's no consistency in these types of errors, their occurrence is random. No issues manifest with the old getSetting/getSettingInt methods. Code:
I get the above error inconsistently when the data in my settings.xml file looks like this. Code:
This is how I initialize the settings object and how I call its methods: Code:
RE: Anyone else finding the new settings class unreliable? - izprtxqkft - 2023-11-14 is it more consistent if you put the type in your setting? Code: <setting id="registration_server_port" type="number">49875</setting> RE: Anyone else finding the new settings class unreliable? - jbinkley60 - 2023-11-14 I concur with setting the type. I have a number of addons with over a hundred settings and have not experienced this but I set the type for each one. I also use the getSetting method in a single function across my addons, whether from the service.py or main addon file:
getSetting has worked for all setting types I have tried. Thanks, Jeff RE: Anyone else finding the new settings class unreliable? - izprtxqkft - 2023-11-14 (2023-11-14, 17:22)jbinkley60 Wrote: getSetting has worked for all setting types I have tried. i do agree it would be better to handle type conversions within python instead of asking getInt to do it, at minimum i like the control that affords ex:
RE: Anyone else finding the new settings class unreliable? - scott967 - 2023-11-15 I always set type and also localized label attributes. Haven't had any problems. Help attribute is optional but I add it with empty string. scott s. . RE: Anyone else finding the new settings class unreliable? - SEIKT - 2023-11-15 Sorry, I should have been clearer. The setting.xml is the file created by Kodi - what the addon reads from.The one I created is this: https://github.com/JDRIVO/DBMC/blob/main/resources/settings.xml The error isn't confined to getInt, it happens with getString too. Code:
RE: Anyone else finding the new settings class unreliable? - izprtxqkft - 2023-11-15 same answer, use getsetting and do type conversions in your own code RE: Anyone else finding the new settings class unreliable? - SEIKT - 2023-11-15 (2023-11-15, 16:53)izprtxqkft Wrote: same answer, use getsetting and do type conversions in your own code Yep, that's the path I'll have to take if I'm not doing anything incorrect to cause these issues. And in that case, it would still be ideal to have these issues addressed as the old methods are due to be phased out in the next release. RE: Anyone else finding the new settings class unreliable? - jbinkley60 - 2023-11-15 (2023-11-15, 17:11)SEIKT Wrote:(2023-11-15, 16:53)izprtxqkft Wrote: same answer, use getsetting and do type conversions in your own code That will need tog et sorted out. The big advantage of the getSetting approach is leveraging a single function to get all settings vs. individual calls, which the sate isn't shared across instances. See this thread. Thanks, Jeff RE: Anyone else finding the new settings class unreliable? - SEIKT - 2023-11-16 Cheers for the feedback gents. This is the approach I took. I only had to change one line of code. Code:
|