doc:appunti:software:kodi_addon_disable_screensaver
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:software:kodi_addon_disable_screensaver [2023/05/20 18:58] – [JSON RPC] niccolo | doc:appunti:software:kodi_addon_disable_screensaver [2023/05/20 21:29] (current) – [How to disable the screensaver from a Kodi add-on] niccolo | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to disable the screensaver | + | ====== How to disable the screensaver |
I wrote a Kodi **[[https:// | I wrote a Kodi **[[https:// | ||
Line 5: | Line 5: | ||
Writing the add-on I faced the problem to disable the screensaver during image playback. It turned out that on the internet you find several examples, which are sometimes confusing and not working. In this page I hope to explain all the possibilities offered by **Kodi 19 Matrix**. | Writing the add-on I faced the problem to disable the screensaver during image playback. It turned out that on the internet you find several examples, which are sometimes confusing and not working. In this page I hope to explain all the possibilities offered by **Kodi 19 Matrix**. | ||
- | ===== JSON RPC ===== | + | Before Kodi 19 Matrix the only way to disable the screensaver was to change settings via the JSON RPC API, starting with version 19 it is possible (and simpler) to call a built-in function. |
+ | |||
+ | ===== Using JSON RPC ===== | ||
There are several Kodi settings related to the screensaver, | There are several Kodi settings related to the screensaver, | ||
- | Into the add-on code you can use the Python function **xbmc.executeJSONRPC()** to communicate with Kodi itself, using the [[https:// | + | Into the add-on code you can use the Python function **xbmc.executeJSONRPC()** to communicate with Kodi itself, using the [[https:// |
- | ^ powermanagement.displaysoff | + | ^ powermanagement.displaysoff |
- | ^ screensaver.mode | + | ^ screensaver.mode |
- | ^ screensaver.time | + | ^ screensaver.time |
- | ^ screensaver.usedimonpause | + | ^ screensaver.usedimonpause |
<code python> | <code python> | ||
- | | + | # Read current value of powermanagement.displaysoff setting. |
- | command = { | + | command = { |
- | ' | + | ' |
- | ' | + | ' |
- | } | + | } |
- | json_rpc = json.loads(xbmc.executeJSONRPC(json.dumps(command))) | + | json_rpc = json.loads(xbmc.executeJSONRPC(json.dumps(command))) |
- | self.saved_powermanagement.displaysoff | + | self.saved_displaysoff |
- | # Set powermanagement.displaysoff to zero, to disable display power off. | + | # Set powermanagement.displaysoff to zero, to disable display power off. |
- | command = { | + | command = { |
- | ' | + | ' |
- | ' | + | ' |
- | } | + | } |
- | json_rpc = json.loads(xbmc.executeJSONRPC(json.dumps(command))) | + | json_rpc = json.loads(xbmc.executeJSONRPC(json.dumps(command))) |
- | | + | |
- | + | # ... Add-on executes its job... | |
+ | |||
+ | # Restore powermanagement.displaysoff to the saved value. | ||
+ | command | ||
+ | ' | ||
+ | ' | ||
+ | } | ||
+ | json_rpc | ||
+ | </ | ||
+ | ===== Using a built-in function ===== | ||
+ | |||
+ | There is another way to disable the screensaver in Kodi: it is a [[https:// | ||
+ | |||
+ | <code python> | ||
+ | # Prevent any screensaver to start. | ||
+ | xbmc.executebuiltin('InhibitScreensaver(true)') | ||
+ | |||
+ | # ... Add-on executes its job... | ||
+ | |||
+ | # Restore the screensaver default behaviour. | ||
+ | xbmc.executebuiltin(' | ||
</ | </ | ||
- | ===== System settings ===== | ||
===== Web References ===== | ===== Web References ===== | ||
Line 40: | Line 61: | ||
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
+ | * **[[https:// | ||
+ | * **[[https:// | ||
doc/appunti/software/kodi_addon_disable_screensaver.1684601887.txt.gz · Last modified: 2023/05/20 18:58 by niccolo