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
@@ -0,0 +1,3 @@
*.DS_Store
*.pyc
*.dylib
@@ -114,28 +114,29 @@ def process_boblight():
if not bob.bob_ping():
connectBoblight()
capture.waitForCaptureStateChangeEvent(1000)
if capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE and not settings.staticBobActive:
if not bob.bob_set_priority(128):
return
width = capture.getWidth();
height = capture.getHeight();
pixels = capture.getImage();
bob.bob_setscanrange(width, height)
rgb = (c_int * 3)()
for y in range(height):
row = width * y * 4
for x in range(width):
rgb[0] = pixels[row + x * 4 + 2]
rgb[1] = pixels[row + x * 4 + 1]
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())
return
if not settings.staticBobActive:
capture.waitForCaptureStateChangeEvent(1000)
if capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE:
if not bob.bob_set_priority(128):
return
width = capture.getWidth();
height = capture.getHeight();
pixels = capture.getImage();
bob.bob_setscanrange(width, height)
rgb = (c_int * 3)()
for y in range(height):
row = width * y * 4
for x in range(width):
rgb[0] = pixels[row + x * 4 + 2]
rgb[1] = pixels[row + x * 4 + 1]
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())
return
elif bobdisable:
log('boblight disabled in Addon Settings')
bobdisable = False

0 comments on commit c973aca

Please sign in to comment.