Python Script Question - Getting previous state?
#1
Question 
Hello,

I am completely new to python I have a little background in C# so I'm not completely clue less.

I want to write a simple if statement script that is aware of its previous result/action. The script will be linked to a button on the remote, so if you press the button the script preforms the ON/True fucntion as it were, press again the script preforms the OFF/False function. Similar to the EjectTray function. Press the button, the tray opens, press again the tray closes.

The only way I can think of doing this is writing something to file and using that to determine the fucntion to preform, is this the best way to do this in python?

The idea around this is to turn on / off x10 modules so there is no way of getting the state from the device.

Thanks,
Qu3
Reply
#2
Plugins are stateless so you would have to maintain the state yourself. Look into the setSetting and getSetting which would help with this. It saves and loads from your userdata/addon_data/plugin/settings.xml file.

http://wiki.xbmc.org/index.php?title=Xbmcaddon_module
Reply

Logout Mark Read Team Forum Stats Members Help
Python Script Question - Getting previous state?0