예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
    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)
예제 #4
0
파일: jokes.py 프로젝트: 0x27/redalert
 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))
예제 #5
0
파일: jokes.py 프로젝트: 5l1v3r1/redalert-1
 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))