def update(): while aok: dataList = list(frames) # Don't bother with GraceNote unless there are # MIN_WINDOW seconds or more of audio if len(dataList) < MIN_NUM_FRAMES: time.sleep(0.1) export(dataList) # do GraceNote and Lightbulb stuff me = MoodEvent(FILENAME) me.submit() global lastUpdateTimeStamp timeStamp = datetime.now() try : me.retrieve_results() if timeStamp < lastUpdateTimeStamp: continue except ValueError as e: print e, 'with', me.filename continue lastUpdateTimeStamp = timeStamp print me.get_bpm(), me.get_mood_label() hsb = grace_to_hsb(me.get_mood_label()) setBulbColor(*hsb)
def GET(self): data=web.input(); lifx.setBulbColor(data.h, data.s, data.b, data.k)