Ejemplo n.º 1
0
 def scanFoundDevice(self, device):
     name = device.getName()
     if not name:
         name = lightblue.finddevicename(device.getAddressString())
     addr = device.getAddressString().replace("-", ":").encode("ascii").upper()
     deviceClass = device.getClassOfDevice()
     self.__emitter.emit(SIGNAL("foundDevice"), addr, name, deviceClass)
Ejemplo n.º 2
0
 def scanFoundDevice(self, device):
     name = device.getName()
     if not name:
         name = lightblue.finddevicename(device.getAddressString())
     addr = device.getAddressString().replace(
         "-", ":").encode('ascii').upper()
     deviceClass = device.getClassOfDevice()
     self.__emitter.emit(SIGNAL("foundDevice"), addr, name, deviceClass)
Ejemplo n.º 3
0
def resolve_name(address):
    try:
        return bluetooth.finddevicename(address, True)
    except Exception, err:
        print err
Ejemplo n.º 4
0
    # Find discoverable devices
    for dev in devices:
        if dev[0] and dev[1]:
            m = re.search('^lfm-([^\s]+)', dev[1])
            if m:
                user = m.group(1)
                userInfo = (dev[0], user)
                if userInfo not in users:
                    print '%s just walked in the door' % user
                    users.append(userInfo)
                    retune = True

    # Find devices we know the mac of
    for user in macMap.items():
        try:
            name = lightblue.finddevicename(user[0], False)
            if name and user not in users:
                print '%s just walked in the door' % user[1]
                users.append(user)
                retune = True
        except:
            pass

    # Clean out devices who are missing
    goodUsers = []
    for user in users:
        try:
            lightblue.finddevicename(user[0], False)
            goodUsers.append(user)
        except:
            retune = True
Ejemplo n.º 5
0
 def _find_service():
     for addr, port, service in lightblue.findservices(name=SERVICE):
         yield addr, port, lightblue.finddevicename(addr)
Ejemplo n.º 6
0
Archivo: sock.py Proyecto: ygl-rg/AIRi
def resolve_name(address):
    try:
        return bluetooth.finddevicename(address, True)
    except Exception, err:
        print err
Ejemplo n.º 7
0
 def _find_service():
     for addr, port, service in lightblue.findservices(name=SERVICE):
         yield addr, port, lightblue.finddevicename(addr)
Ejemplo n.º 8
0
        if elem.tag == 'pubDate':
            currentTime = time.mktime(time.strptime(elem.text, '%a, %d %b %Y %H:%M:%S +0000'))
            break

    if oldTime == 0 and currentTime != 0:
        oldTime = currentTime
        continue

    if (currentTime != 0 and currentTime != oldTime):
        print "%s scrobbled something, looking for devices to scrobble to..." % user;

        oldTime = currentTime

        # Find devices we know the mac of
        foundMacs = []
        for mac in macs:
            try:
                name = lightblue.finddevicename(mac, False)
                print "Found %s" % mac
                foundMacs.append(mac)
            except:
                pass

        if foundMacs:
            macString = ','.join(foundMacs)
            scrobUrl = config.get('blobbler', 'server') + '?user='******'&macs=' + macString
            print "Scrobbling: %s" % scrobUrl
            urllib2.urlopen(scrobUrl)

    time.sleep(60)