Kodi Community Forum

Full Version: HTTP API or similar code to test screensaver is active
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I wondered if anyone knew of a way to test from a script whether the XBMC screensaver is running?

I've looked through GUISettings.cpp for something that would be available via the HTTP API, but can't find anything that seems relevant.

Basically I'd looking to write a script to test that XBMC is idle (so I have test's for currentlyplaying and currentslide), I wanted to use the screensaver as a final confirmation that nothing was going on.

Cheers in advance,
~Dan
I think that it's been long enough that I can bump ... anyone got a suggestion?

I'm wondering though if this post might be in the wrong place and will post a similar question in the general support.
That is correct, the other forum is for actual development, this is more for releases and support threads for actual plugins / scripts.
http://forum.xbmc.org/forumdisplay.php?fid=26

I don't know how you can test whether the screensaver is active, just going to post the HTTP API commands here:
http://www.xbmc.org/wiki/?title=WebServerHTTP-API

and also to mention the XBMC builting functions - can be called through a plugin / script with xbmc.executebuiltin()
http://www.xbmc.org/wiki/?title=List_of_..._Functions
Dan,

Thanks for your reply, I'd trawled through the built-in functions and HTTP API and not found anything (though I will concede that I might have missed the command that gave me what I wanted Oo).

I ended up adding a command isscreensaver active to the HTTP API myself which works quite well. It made me realise how long it's been since I've worked in C++ though!

Cheers for your help.
I was thinking that another option is to check if video / audio / pictures are "playing", check the System.IdleTime() and if longer than the "Screensaver idle timeout", that would probably mean that the screensaver is on.

But having a specific function does help, maybe you can submit your code changes as an enhancement request to be included in the base code (http://trac.xbmc.org), definitely others will find it useful as well.
I am actually performing a check on audio / video / pictures in my script. The screen saver check would have just been the final check I needed. For some reason I'd never been able to get a response from the system.IdleTime() function, don't know why but anything I tried returned an error message.

I was going to look at submitting the code ... just need to read the wiki and figure how I do that Blush

As an aside, how do you query the system.idletime?
On the code change, you simply logon in trac (http://trac.xbmc.org) with the forum username / password and log a ticket for that.

Haven't used them myself, but they may work through xbmc.getCondVisibility()...
http://xbmc.sourceforge.net/python-docs/...Visibility
http://www.xbmc.org/wiki/?title=List_of_...Conditions