2015-11-22, 22:37
I was going to suggest a similar solution but nickr beat me to it.
Because each run won't leave a simple way to access a memory stored variable, I would create and destroy a token file.
Something like:
Disclaimer: I didn't actually test this code yet
Because each run won't leave a simple way to access a memory stored variable, I would create and destroy a token file.
Something like:
Code:
import xbmc, xbmcvfs
pth = xbmc.translatePath('special://userdata/addon_data/service.xbmc.callbacks2')
fn = xbmc.translatePath('special://userdata/addon_data/service.xbmc.callbacks2/token.txt')
if not xbmcvfs.exists(pth):
xbmcvfs.mkdirs(pth)
if xbmcvfs.exists(fn):
xbmcvfs.delete(fn)
# No code to execute here
else:
with open(fn, 'w') as f:
f.write('X')
pass # Your code goes here or call subprocess to launch something else
Disclaimer: I didn't actually test this code yet