Add-on settings type="bool" not bool exactly.
#1
I wonder why addon setings type="bool" return string(str)? Don't you think returning bool better? Is it mistake or devs did it and like it like that?
Reply
#2
one function to handle them all or special casing per type.. easy choice.
Reply
#3
LOL @spiff can you translate what you wrote? Smile
Reply
#4
(2012-04-17, 11:41)queeup Wrote: LOL @spiff can you translate what you wrote? Smile

all is handled within one function instead of creating special function for each setting type that splits up BOOL and STRING and so on.
So basicly the shortest way
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
#5
OK then like always need ( if settings == 'true': ) for turn str to bool. Thx.
Reply
#6
also if for example use a slider control and add option='int' it still returns something like '5.000000' so you need to strip all the zeros and the dot
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
(2012-04-17, 11:56)queeup Wrote: OK then like always need ( if settings == 'true': ) for turn str to bool. Thx.

One option is to write a small function to translate what you get from the setting into an actual boolean. If none of my settings will change during script run, I often just have a procedure that gets all the settings and changes them to what I'd like at the beginning. It depends on how many times you're going to get frustrated having:

if ( settings == 'true' ):

Rather than:

if ( setting_bool ):

For me the threshold is usually about two. Wink

Reply

Logout Mark Read Team Forum Stats Members Help
Add-on settings type="bool" not bool exactly.0