Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Trying forever until caught as walking dead.
  • Loading branch information
helioloureiro committed Oct 16, 2016
1 parent f3d9699 commit b30d42c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions weather-twitter.py
Expand Up @@ -246,16 +246,17 @@ def GetPhoto(f = None, quality = None):
debug(" * * getting image")
debug("Smile!")
image = cam.get_image()
counter = 1000
while (counter):
counter = 0
# try forever and, in failure, get killed by monitoring
while (True):
print "Checking: %d =" % counter,
avg = sum(pygame.transform.average_color(image)) /3
print avg
if (avg >= 30) and (avg <= 200):
counter = 0
break
image = cam.get_image()
counter -= 1
counter += 1
debug("Camera stop")
cam.stop()
pygame.quit()
Expand Down

0 comments on commit b30d42c

Please sign in to comment.