def __do__(self): run_async(Bot.play_sound, (ASSETS_FOLDER_PATH + '/sounds/gfdr.mp3',)) NeoPixels.police(NeoPixels.broadcast_address, '50') time.sleep(10) NeoPixels.off(NeoPixels.broadcast_address) Bot.kill_sound() pass
def __do__(self): run_async(Bot.play_sound, (ASSETS_FOLDER_PATH + '/sounds/gfdr.mp3', )) NeoPixels.police(NeoPixels.broadcast_address, '50') time.sleep(10) NeoPixels.off(NeoPixels.broadcast_address) Bot.kill_sound() pass
def __run__(self, time): if time['hour'] == '13' and time['min'] == '15': result = urlopen( "http://finance.yahoo.com/d/quotes.csv?s=MSFT&f=spc1").read() result = result.decode('utf-8').strip().split(',') direction = 'down' if float(result[2]) > 0: direction = 'up' msg = template.format( result[1].replace('.', ' point '), direction, result[2].replace('.', ' point ').replace('-', ''), '') Bot.speak(msg) if direction == 'up': icon_back = IconBackgrounds.Green speak = random.choice(praise) Bot.speak(speak) else: icon_back = IconBackgrounds.Red speak = random.choice(motivate) Bot.speak(speak) Timeline.add_item_from_bot( 'Stock update', template.format(result[1], direction, result[2].replace('-', ''), speak), '', Icons.LineChart, icon_back)
def __run__(self, time): if int(time['hour']) % 5 == 0 and time['min'] == '00': jokes = ['newword.mp3', 'policechief.mp3'] Bot.play_sound(ASSETS_FOLDER_PATH + '/sounds/' + random.choice(jokes))