Переход на UTF8.
[pyrungps.git] / parsegpx.py
index 5247c27d7ff7382966f67bbf2df36b8e3c41356c..25161c8d761517d5d46122d777c71fe8efb022e3 100644 (file)
@@ -6,10 +6,18 @@ import os
 from lxml import etree
 from urllib2 import unquote
 import pygpx
-import pyosmname
+import pygeocode
 import sqlite3
 import datetime
 
+def check_db_for_training(db,sport,timestamp):
+
+  conn = sqlite3.connect(db)
+  cur = conn.cursor()
+
+  cur.execute ("select count(*) from tracks where sport=? and start_time=?" , (sport,timestamp))
+  return cur.fetchall()[0][0]
+
 def write_parsed_to_db(db,gpx,filename):
 
   conn = sqlite3.connect(db)
@@ -44,7 +52,7 @@ def write_parsed_to_db(db,gpx,filename):
         print "processing..."
         start = track.start()
         if start:
-          printable = pyosmname.GeoName(start.lat,start.lon).printable
+          printable = pygeocode.GeoName(start.lat,start.lon).printable
           start_time = track.start_time()
           full_duration = track.full_duration().total_seconds()
           distance = track.distance()