Kodi Community Forum

Full Version: How to quit basic screensaver using code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have developed a ridiculously simple screensaver that runs PseudoTV Live when activated, basically for the purpose of if a person sits on the main menu, it "exits to tv".  

Of course I added simple code to make sure that it doesn't try to load PTV again if the video is paused, since technically Kodi will activate the screensaver if video is paused for too long, even while PTV is running.

So this all works so far, but it has one minor annoyance that I would like to do away with.  If I am playing video and I pause it, my code works as it should, the video stays paused and nothing happens.  The only exception is when I press play nothing happens, I then have to press play a second time and the video resumes.  I believe that the reason for this is even though in my code, because video is currently playing, it chooses not to load PTV or do anything, the screensaver itself is at this point technically running.  Meaning that when I press play, I have then exited out of the screensaver, and now I have to press play again to resume the video.  

So my question is.  Using python, how do I simply exit the screensaver itself through code?  I already used self.close(), but I still get this issue, so I assume that it is still not closing.

This is my code:
import xbmc, os, sys

if bool(xbmc.getCondVisibility("Player.Paused")):
    self.close()
else:
    xbmc.executebuiltin('XBMC.RunAddon(script.pseudotv.live)')