Advertisement
lukibeni

Untitled

Oct 28th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. def saveLastScan():
  2.     date = int(time.time())
  3.     droid.prefPutValue("smsLastScan", date, "datestamp")
  4.     return date
  5.  
  6. def getLastScan():
  7.     date = droid.prefGetValue("smsLastScan", "datestamp")
  8.     if (date.result == None):
  9.         date2 = int(time.mktime(datetime.datetime(2000, 1, 1).timetuple()))
  10.         return date2
  11.     else:
  12.         return date.result
  13.  
  14. def warehouseStringToDict(b):
  15.     a = b.split(";")
  16.     if len(a) != 5 :
  17.         return None
  18.     if a[0] != "WarehouseData":
  19.         return None
  20.     if (a[1].isdigit() == False):
  21.         return None
  22.     try:
  23.         float(a[3])
  24.         float(a[4])
  25.     except ValueError:
  26.         return None
  27.     asd  = {"id" : a[1]}
  28.     asd["name"] = a[2]
  29.     asd["lat"] = a[3]
  30.     asd["lon"] = a[4]
  31.     return asd
  32.  
  33. def scanMessages(lastScanInteger):
  34.     sms = droid.smsGetMessages(False)
  35.     for i in sms.result:
  36.         if (int(i["date"]) > lastScanInteger):
  37.             if warehouseStringToDict(i["body"]) != None:
  38.                 malls.append(warehouseStringToDict(i["body"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement