Permalink
Browse files

if static is on, no need to even check CaptureState()

  • Loading branch information...
amet committed Apr 15, 2012
1 parent a6673d5 commit c973acafceaf5477bee52fc60e97acbce9c009ff
Showing with 26 additions and 22 deletions.
  1. +3 −0 .gitignore
  2. +23 −22 script.xbmc.boblight/default.py
View
@@ -0,0 +1,3 @@
*.DS_Store
*.pyc
*.dylib
@@ -114,28 +114,29 @@ def process_boblight():
if not bob.bob_ping(): if not bob.bob_ping():
connectBoblight() connectBoblight()
capture.waitForCaptureStateChangeEvent(1000) if not settings.staticBobActive:
if capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE and not settings.staticBobActive: capture.waitForCaptureStateChangeEvent(1000)
if not bob.bob_set_priority(128): if capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE:
return if not bob.bob_set_priority(128):
return
width = capture.getWidth();
height = capture.getHeight(); width = capture.getWidth();
pixels = capture.getImage(); height = capture.getHeight();
bob.bob_setscanrange(width, height) pixels = capture.getImage();
rgb = (c_int * 3)() bob.bob_setscanrange(width, height)
for y in range(height): rgb = (c_int * 3)()
row = width * y * 4 for y in range(height):
for x in range(width): row = width * y * 4
rgb[0] = pixels[row + x * 4 + 2] for x in range(width):
rgb[1] = pixels[row + x * 4 + 1] rgb[0] = pixels[row + x * 4 + 2]
rgb[2] = pixels[row + x * 4] rgb[1] = pixels[row + x * 4 + 1]
bob.bob_addpixelxy(x, y, byref(rgb)) rgb[2] = pixels[row + x * 4]
bob.bob_addpixelxy(x, y, byref(rgb))
if not bob.bob_sendrgb():
log("error sending values: %s" % bob.bob_geterror()) if not bob.bob_sendrgb():
return log("error sending values: %s" % bob.bob_geterror())
return
elif bobdisable: elif bobdisable:
log('boblight disabled in Addon Settings') log('boblight disabled in Addon Settings')
bobdisable = False bobdisable = False

0 comments on commit c973aca

Please sign in to comment.