Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def notifyLure(id,lat,lng,exptime):
- timeLeft = exptime-datetime.utcnow()
- cet = timezone('Europe/Budapest')
- cet_time = datetime.now(cet)
- currentTime = cet_time.strftime('%Y.%m.%d. %H:%M:%S')
- latLon = '{},{}'.format(repr(lat), repr(lng))
- gMapsUrl = 'http://maps.google.com/maps/place/{}/@{},{}z'.format(latLon, latLon, 18)
- floatLat = float(lat)
- floatLong = float(lng)
- g = geocoder.google([floatLat, floatLong], method='reverse')
- print("NOTIFYLURE: ID: %s\nCoord: (%f,%f)\n TimeLeft: %s" % (
- id,lat,lng,str(timeLeft)))
- if id in lures:
- print("ALREADY SEEN LURE")
- return
- else:
- lures.append(id)
- doPrint = True
- if doPrint:
- p = PushBullet(apiKey)
- # Get a list of devices
- devices = p.getDevices()
- # Get a list of contacts
- contacts = p.getContacts()
- # Send a note
- #p.pushNote(devices[0]["iden"],"Found Lure: Coord: (%f,%f)" % (
- # lat,lng), "Coord: (%f,%f)\n TimeLeft: %s" % (
- # lat,lng,str(timeLeft)))
- p.pushNote(devices[0]["iden"],"Lure - %s, %s %s" % (
- g.city,g.street,g.housenumber), "CurrentTime: %s\nTimeLeft: %s\nGoogleMaps: %s" % (
- currentTime,str(timeLeft).split('.')[0],gMapsUrl))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement