2023-12-22, 18:44
I'm trying to use the new settings class with a type="time" as defined in my addon's settings.xml
The time I'm trying to set is "8:00". This seems to be stored as a string in the userdata settings.xml, and returns a string with Settings.getString or with the older getSetting method.
However, trying to set a string results in an error, and the other setters won't accept the colon in the time format as they want ints or floats. I assume the 'date' setting type has a similar problem but I haven't tried it.
I don't know if this is a bug or there's something I don't understand:
The time I'm trying to set is "8:00". This seems to be stored as a string in the userdata settings.xml, and returns a string with Settings.getString or with the older getSetting method.
However, trying to set a string results in an error, and the other setters won't accept the colon in the time format as they want ints or floats. I assume the 'date' setting type has a similar problem but I haven't tried it.
I don't know if this is a bug or there's something I don't understand:
xml:
<setting id="morningTime" type="time" label="31334" help=""> <level>2</level> <default>08:00</default> <control type="button" format="time"> <heading>31334</heading> </control> </setting>
python:
ADDON = xbmcaddon.Addon()
ADDONSETTINGS = ADDON.getSettings()
ADDONSETTINGS.setString("morningTime", "8:00")
python:
Traceback (most recent call last):
File "D:\dev\kodi20\Kodi\addons\script.service.hue\service.py", line 11, in <module>
core.core()
File "D:\dev\kodi20\Kodi\addons\script.service.hue\resources\lib\core.py", line 21, in core
kodiutils.validate_settings()
File "D:\dev\kodi20\Kodi\addons\script.service.hue\resources\lib\kodiutils.py", line 22, in validate_settings
_validate_schedule()
File "D:\dev\kodi20\Kodi\addons\script.service.hue\resources\lib\kodiutils.py", line 52, in _validate_schedule
ADDONSETTINGS.setString("morningTime", "8:00")
TypeError: Invalid setting type "string" for "morningTime"