1. Jason Scheirer
  2. Stumbler

Commits

Jason Scheirer  committed ef3fdb6

TextFactory

  • Participants
  • Parent commits ddbdbbd
  • Branches default

Comments (0)

Files changed (1)

File test_program.py

View file
 gps = gpsfix.GpsD(twisted.internet.reactor)
 
 conn = sqlite3.connect("gpslog.sqlite")
+comm.text_factory = sqlite3.OptimizedUnicode
 
 def refresh_5():
-    die = [key for key in cache if ((time.time() - cache[key]['age']) > 500.0)]
+    die = [key for key in cache if ((time.time() - cache[key]['age']) > 2400.0)]
     if die:
         print "Dead nets: ", die
         for key in die:
             del cache[key]
     netlist.update()
-    twisted.internet.reactor.callLater(10, refresh_5)
+    twisted.internet.reactor.callLater(5, refresh_5)
     conn.commit()
 
 def secondly():
                     cache[key]['age'] = time.time()
             if insert:
                 print row
-                conn.execute("""INSERT INTO networks(timestamp, lat, lon, 
-                                                     hwaddress, ssid, strength)
-                         VALUES (?, ?, ?, ?, ?, ?)""", list(row))
+                try:
+                    conn.execute("""INSERT INTO networks(timestamp, lat, lon, 
+                                                         hwaddress, ssid, strength)
+                             VALUES (?, ?, ?, ?, ?, ?)""", list(row))
+                except Exception, e:
+                    print "ERR", e
     print
     twisted.internet.reactor.callLater(1, secondly)