2022-04-10, 06:47
I'm trying to build an addon that controls a case fan for raspberry pi 4.
I need to open a .conf file, read line by line, associate lines to values(line1=temp1,line2=speed1,...) then set those values to be controlled by setting type=number in settings.xml.
So at the moment I'm trying to understand how an addon script communicates with the settings.xml file.
I can open the file and set each line as a reference to be used later.
I just don't know where to start to have that work in conjunction with my settings.xml code.
This is the code in settings.xml:
The addon.py:
file = 'C:\\Users\\Joe\\AppData\\Roaming\\Kodi\\addons\\script.hellotestwindow\\resources\\test.conf'
does anyone know how to do this?
Or at least where to start?
Anything about anything would help, I have absolutely no idea what to search.
I did find a kodi docs website, that showed options like:
But I don't know how they work, or if it's even the correct code to use.
Any help would be GREATLY APPRECIATED
thank you
I need to open a .conf file, read line by line, associate lines to values(line1=temp1,line2=speed1,...) then set those values to be controlled by setting type=number in settings.xml.
So at the moment I'm trying to understand how an addon script communicates with the settings.xml file.
I can open the file and set each line as a reference to be used later.
I just don't know where to start to have that work in conjunction with my settings.xml code.
This is the code in settings.xml:
Code:
<setting label="start temp" type="number" id="temp1" default="30"/>
<setting label="start fan speed" type="number" id="speed1" default="25" subsetting="true"/>
The addon.py:
file = 'C:\\Users\\Joe\\AppData\\Roaming\\Kodi\\addons\\script.hellotestwindow\\resources\\test.conf'
Code:
class Main:
# constructor of Main class
def __init__(self):
# Initialization of the Strings
with open(file) as f:
lines = [line.rstrip('\n') for line in f]
self.lines = lines
def set_setting(self):
?? ?? ?? ??
if __name__ == '__main__':
Main().set_setting()
does anyone know how to do this?
Or at least where to start?
Anything about anything would help, I have absolutely no idea what to search.
I did find a kodi docs website, that showed options like:
Code:
XBMCAddon::xbmcplugin::getSetting (int handle, const char *id)
XBMCAddon::xbmcplugin:: setSetting (int handle, const String &id, const String &value)
But I don't know how they work, or if it's even the correct code to use.
Any help would be GREATLY APPRECIATED
thank you