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
Exemplo n.º 2
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
Exemplo n.º 3
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
Exemplo n.º 4
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
Exemplo n.º 5
0
from gi.repository import GdkPixbuf as pixbuf
from gi.repository import Gtk as gtk
from gi.repository import GObject as gobject

FILEFOLDER="/tmp/lispeak_" + getpass.getuser()

#ar = lispeak.getSingleInfo("ARDUINO")
#if ar == "":
#    ar = '/dev/ttyACM1'
#    lispeak.writeSingleInfo('ARDUINO','/dev/ttyACM1')
#lcd = lispeak.arduino(lispeak.getSingleInfo("ARDUINO"))
#lcd.sendText("Welcome|LiSpeak LCD;")

preInfo = lispeak.getInfo()
if "NOTIFICATIONS" not in preInfo:
    lispeak.writeSingleInfo("NOTIFICATIONS","LiSpeak")
if "NOTIFYX" not in preInfo:
    lispeak.writeSingleInfo("NOTIFYX","50")
if "NOTIFYY" not in preInfo:
    lispeak.writeSingleInfo("NOTIFYY","50")
if "MESSAGES" not in preInfo:
    lispeak.writeSingleInfo("MESSAGES","False")


try:
    os.chdir("Microphone")
except:
    print "Currently in",os.getcwd()

try:
    from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GdkPixbuf as pixbuf
from gi.repository import Gtk as gtk
from gi.repository import GObject as gobject

FILEFOLDER = "/tmp/lispeak_" + getpass.getuser()

#ar = lispeak.getSingleInfo("ARDUINO")
#if ar == "":
#    ar = '/dev/ttyACM1'
#    lispeak.writeSingleInfo('ARDUINO','/dev/ttyACM1')
#lcd = lispeak.arduino(lispeak.getSingleInfo("ARDUINO"))
#lcd.sendText("Welcome|LiSpeak LCD;")

preInfo = lispeak.getInfo()
if "NOTIFICATIONS" not in preInfo:
    lispeak.writeSingleInfo("NOTIFICATIONS", "LiSpeak")
if "NOTIFYX" not in preInfo:
    lispeak.writeSingleInfo("NOTIFYX", "50")
if "NOTIFYY" not in preInfo:
    lispeak.writeSingleInfo("NOTIFYY", "50")
if "MESSAGES" not in preInfo:
    lispeak.writeSingleInfo("MESSAGES", "False")

try:
    os.chdir("Microphone")
except:
    print "Currently in", os.getcwd()

try:
    from dbus.mainloop.glib import DBusGMainLoop
except ImportError:
Exemplo n.º 7
0
from gi.repository import Gdk as gdk
from gi.repository import GdkPixbuf as pixbuf
from gi.repository import Gtk as gtk
from gi.repository import GObject as gobject

FILEFOLDER="/tmp/lispeak_" + getpass.getuser()

#ar = lispeak.getSingleInfo("ARDUINO")
#if ar == "":
#    ar = '/dev/ttyACM1'
#    lispeak.writeSingleInfo('ARDUINO','/dev/ttyACM1')
#lcd = lispeak.arduino(lispeak.getSingleInfo("ARDUINO"))
#lcd.sendText("Welcome|LiSpeak LCD;")

if "NOTIFICATIONS" not in lispeak.getInfo():
    lispeak.writeSingleInfo("NOTIFICATIONS","LiSpeak")

try:
    os.chdir("Microphone")
except:
    print "Currently in",os.getcwd()

try:
    from dbus.mainloop.glib import DBusGMainLoop
except ImportError:
    from dbus.mainloop.qt.DBusQtMainLoop import DBusGMainLoop
    #if none exists, an ImportError will be throw
DBusGMainLoop(set_as_default=True)

class MyDBUSService(dbus.service.Object):
    """ This is a service that waits for somebody call create_notification(data) """