Global Persistent Variables
#1
Hi,

I have an addon script that can be invoked remotely via the JSONRPC interface, but I need a mechanism to prevent the script from running multiple instances.

I have though of creating a lock file / lock variable and checking for that when the script is invoked.

I don't want to write to the SD disk all the time and prefer a persistent memory variable (persistent until reboot is ok) to be used for a lock.

Can you create global memory variables that persist after a script exists that can be read / checked the next time the script runs?

How do you create such a persistent memory variable?
Reply
#2
an easy way to prevent multiple instances, would be to use window properties:
http://mirrors.xbmc.org/docs/python-docs...etProperty


Code:
WIN = xbmcgui.Window(10000)
if WIN.getProperty('myaddon.running') == 'True':
    ...exit
else:
    WIN.setProperty('myaddon.running', 'True')
    ...do something
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks, I did not know that.
Reply

Logout Mark Read Team Forum Stats Members Help
Global Persistent Variables0