Exemple #1
0
    def message_system(self):
        if self.info['MESSAGES'] == "True":
            f = urllib2.urlopen(
                "http://lispeak.bmandesigns.com/functions.php?f=messageUpdate")
            text = f.read()
            message = json.loads(text.replace('\r',
                                              '\\r').replace('\n', '\\n'),
                                 strict=False)
            lastId = lispeak.getSingleInfo("lastid")
            if lastId == "":
                lastId = message['id']
            try:
                go = int(message['id']) > int(lastId)
            except:
                go = True
            if go:
                if 'icon' in message:
                    urllib.urlretrieve(message['icon'], "/tmp/lsicon.png")
                    self.queue.append({
                        'title': "LiSpeak - " + message['title'],
                        'message': message['text'],
                        'icon': "/tmp/lsicon.png",
                        "speech": message['text']
                    })
                else:
                    self.queue.append({
                        'title': "LiSpeak - " + message['title'],
                        'message': message['text'],
                        "speech": message['text']
                    })

            lispeak.writeSingleInfo("lastid", str(int(message['id'])))
        return True
Exemple #2
0
 def message_system(self):
     f = urllib2.urlopen("http://lispeak.bmandesigns.com/functions.php?f=messageUpdate")
     text = f.read()
     message = json.loads(text.replace('\r', '\\r').replace('\n', '\\n'),strict=False)
     lastId = lispeak.getSingleInfo("lastid")
     if lastId == "":
         lastId = message['id']
     try:
         go = int(message['id']) > int(lastId)
     except:
         go = True
     if go:
         if 'icon' in message:
             urllib.urlretrieve(message['icon'], "/tmp/lsicon.png")
             self.queue.append({'title':"LiSpeak - "+message['title'],'message':message['text'],'icon':"/tmp/lsicon.png","speech":message['text']})
         else:
             self.queue.append({'title':"LiSpeak - "+message['title'],'message':message['text'],"speech":message['text']})
     
     lispeak.writeSingleInfo("lastid",str(int(message['id'])))
     return True
Exemple #3
0
 def message_system(self):
     print "Checking for Message"
     f = urllib2.urlopen("http://lispeak.bmandesigns.com/functions.php?f=messageUpdate")
     text = f.read()
     message = json.loads(text.replace('\r', '\\r').replace('\n', '\\n'),strict=False)
     lastId = lispeak.getSingleInfo("lastid")
     print "Checking done." #debug 14 seconds !?!
     if lastId == "":
         lastId = message['id']
     try:
         go = int(message['id']) > int(lastId)
     except:
         go = True
     if go:
         if 'icon' in message:
             urllib.urlretrieve(message['icon'], "/tmp/lsicon.png")
             self.queue.append({'TITLE':"LiSpeak - "+message['title'],'MESSAGE':message['text'],'ICON':"/tmp/lsicon.png","SPEECH":message['text']})
         else:
             self.queue.append({'TITLE':"LiSpeak - "+message['title'],'MESSAGE':message['text'],"SPEECH":message['text']})
     
     lispeak.writeSingleInfo("lastid",str(int(message['id'])))
     return True
Exemple #4
0
             os.rename("pycmd_result","pycmd_nocmd")
         except:
             pass
         try:
             os.remove("result")
         except:
             pass
         try:
             os.remove("result_image")
         except:
             pass
         if os.path.exists("speak"):
             f = open("speak")
             body = f.read()
             f.close()
         if lispeak.getSingleInfo("TTS") == "True":
             if body != "":
                 lispeak.speak(title+". "+body)
             else:
                 lispeak.speak(title)     
     except:
         pass
 while os.path.exists("pycmd_stop"):
     os.system("touch in_red")
     n.update(lispeak.translate("Please wait"),"",PWD+"/Not_Ready/stop.png")
     n.show()
     #try:
     #    os.rename("pycmd_stop","pycmd_nocmd")
     #except:
     #    pass
 time.sleep(.05)
Exemple #5
0
             os.rename("pycmd_result", "pycmd_nocmd")
         except:
             pass
         try:
             os.remove("result")
         except:
             pass
         try:
             os.remove("result_image")
         except:
             pass
         if os.path.exists("speak"):
             f = open("speak")
             body = f.read()
             f.close()
         if lispeak.getSingleInfo("TTS") == "True":
             if body != "":
                 lispeak.speak(title + ". " + body)
             else:
                 lispeak.speak(title)
     except:
         pass
 while os.path.exists("pycmd_stop"):
     os.system("touch in_red")
     n.update(lispeak.translate("Please wait"), "",
              PWD + "/Not_Ready/stop.png")
     n.show()
     #try:
     #    os.rename("pycmd_stop","pycmd_nocmd")
     #except:
     #    pass