示例#1
0
        self.client.play()

    def post_song(self):
        status = self.client.currentsong()
        text = 'u%s - %s' % (status['artist'], status['title'])
        print "Sende", text
        send_message('camerapi', unidecode(text))

    def teardown(self):
        teardown()
        

if __name__ == '__main__':
    #myqeompd = Qeompd()
  
    q = QeoApi()
    retval = q.setup() 
    if retval == 0:
        q.start_receiving(handle_message)
        thread.join()
    
    while True:
        try: 
            time.sleep(1)
        except KeyboardInterrupt:
            break
        #sample = random.sample(["sad", "happy", "calm", "energy"], 1)[0]
        #print sample
        #myqeompd.play(sample)
        #myqeompd.post_song()
示例#2
0
        self.client.play()

    def post_song(self):
        status = self.client.currentsong()
        text = "u%s - %s" % (status["artist"], status["title"])
        print "Sende", text
        send_message("camerapi", unidecode(text))

    def teardown(self):
        teardown()


if __name__ == "__main__":
    # myqeompd = Qeompd()

    q = QeoApi()
    retval = q.setup()
    if retval == 0:
        q.start_receiving(handle_message)
        thread.join()

    while True:
        try:
            time.sleep(1)
        except KeyboardInterrupt:
            break
        # sample = random.sample(["sad", "happy", "calm", "energy"], 1)[0]
        # print sample
        # myqeompd.play(sample)
        # myqeompd.post_song()
示例#3
0
文件: hue.py 项目: uwekamper/fester

def set_mood(mood):
    colors = COLORS[mood]
    lights = [Light(1), Light(2), Light(3)]
    for idx, light in enumerate(lights):
        light.turn_on()
        color_idx = idx % len(colors)
        light.change_hsb(*colors[color_idx])


def my_callback(message):
    if message in COLORS.keys():
        set_mood(message)
    else:
        print "Ignored unknown mood", message


qeo = QeoApi()

if __name__ == '__main__':
    r = qeo.setup()
    if r == 0:
        qeo.start_receiving(my_callback)
        try:
            while True:
                time.sleep(1)
        except KeyboardInterrupt:
            qeo.stop_receiving()
            qeo.teardown()
示例#4
0
文件: hue.py 项目: uwekamper/fester

def set_mood(mood):
    colors = COLORS[mood]
    lights = [Light(1), Light(2), Light(3)]
    for idx, light in enumerate(lights):
        light.turn_on()
        color_idx = idx % len(colors)
        light.change_hsb(*colors[color_idx])


def my_callback(message):
    if message in COLORS.keys():
        set_mood(message)
    else:
        print "Ignored unknown mood", message


qeo = QeoApi()

if __name__ == "__main__":
    r = qeo.setup()
    if r == 0:
        qeo.start_receiving(my_callback)
        try:
            while True:
                time.sleep(1)
        except KeyboardInterrupt:
            qeo.stop_receiving()
            qeo.teardown()