2018-02-04, 22:24
hi.
Trying to create a python script that does the following:
1) On first 'i' keypress on fullscreen show the INFO action
2) On second 'i' keypress on fullscreen show the OSD action
.. then start all over ..
fullscreenvideo.py looks like :
import xbmc
myGlobal = 1
if myGlobal == 1:
xbmc.executebuiltin("Action(Info)")
myGlobal = 2
elif myGlobal == 2:
xbmc.executebuiltin("Action(OSD)")
myGlobal = 1
keyboard.xml snippet looks like:
<FullscreenVideo>
<keyboard>
<i>runscript(special://masterprofile/addon_data/scripts/fullscreenvideo.py)</i>
</keyboard>
</FullscreenVideo>
It seems like each time my .py script is called, which does get called, the myGlobal variable is always 1.
How do I create a static variable that will keep its value each time the script is called ?
I guess a hack would be to persist the value in a file of some kind. The read the file accordingly.
Anyone out there who can help a python noob with this ?
/gibman
Trying to create a python script that does the following:
1) On first 'i' keypress on fullscreen show the INFO action
2) On second 'i' keypress on fullscreen show the OSD action
.. then start all over ..
fullscreenvideo.py looks like :
import xbmc
myGlobal = 1
if myGlobal == 1:
xbmc.executebuiltin("Action(Info)")
myGlobal = 2
elif myGlobal == 2:
xbmc.executebuiltin("Action(OSD)")
myGlobal = 1
keyboard.xml snippet looks like:
<FullscreenVideo>
<keyboard>
<i>runscript(special://masterprofile/addon_data/scripts/fullscreenvideo.py)</i>
</keyboard>
</FullscreenVideo>
It seems like each time my .py script is called, which does get called, the myGlobal variable is always 1.
How do I create a static variable that will keep its value each time the script is called ?
I guess a hack would be to persist the value in a file of some kind. The read the file accordingly.
Anyone out there who can help a python noob with this ?
/gibman