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)
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()