script.xbmc.hue.ambilight
script.xbmc.hue.ambilight copied to clipboard
API change - Kodi 17.0
I want to inform you about an API change that comes with version 17.0. Some architectural change required to change the API for RenderCapture: https://github.com/xbmc/xbmc/pull/8613
See this example of boblight for how to deal with the change: https://github.com/bobo1on1/script.xbmc.boblight/commit/d35ae91cb26cc6042c86369a98cad70c3691c10d
this is a quick&dirty fix for API 17.0
--- default_hue_orig.py 2016-03-23 21:11:59.000000000 +0100
+++ default_fix.py 2016-03-23 21:34:57.000000000 +0100
@@ -427,8 +427,8 @@
else:
xbmc.sleep(100)
- capture.waitForCaptureStateChangeEvent(1000/60)
- if capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE:
+ pixels = capture.getImage(1000)
+ if len(pixels) > 0:
if player.playingvideo:
screen = Screenshot(capture.getImage(), capture.getWidth(), capture.getHeight())
hsvRatios = screen.spectrum_hsv(screen.pixels, screen.capture_width, screen.capture_height)
@@ -490,7 +490,7 @@
capture_width = 32 #100
capture_height = int(capture_width / capture.getAspectRatio())
logger.debuglog("capture %s x %s" % (capture_width, capture_height))
- capture.capture(capture_width, capture_height, xbmc.CAPTURE_FLAG_CONTINUOUS)
+ capture.capture(capture_width, capture_height)
if (state == "started" and pauseafterrefreshchange == 0) or state == "resumed":
if hue.settings.mode == 0 and hue.settings.ambilight_dim: # only if a complete group