X-Git-Url: https://git.rvb.name/pyrungps.git/blobdiff_plain/7b110d16b72ee2c5ce13a2a45de656390526ce81..096f13fe34f8352a16bc9fc2824df37e93368d2b:/pyrungps.py?ds=sidebyside diff --git a/pyrungps.py b/pyrungps.py index 58dd344..bff314a 100644 --- a/pyrungps.py +++ b/pyrungps.py @@ -16,7 +16,7 @@ def get_page(uname,year,month): trainings = [] - req = urllib2.Request("http://www.gps-sport.net/embedCalendar.jsp?userName=%s&year=%s&month=%s"% (uname,year,month), None, {'User-agent': 'Mozilla/5.0'}) + req = urllib2.Request("http://www.gps-sport.net/services/getMonthlyTrainingDataHTML_V2.jsp?userName=%s&year=%s&month=%s&rnd=0.645673"% (uname,year,month), None, {'User-agent': 'Mozilla/5.0'}) page = urllib2.urlopen(req).read() dom = html.document_fromstring(page) @@ -31,7 +31,9 @@ def get_page(uname,year,month): def get_gpx_track(trid,name): - req = urllib2.urlopen("http://www.gps-sport.net/services/trainingGPX.jsp?trainingID=%s" % (trid)) + print "trid=",trid + + req = urllib2.urlopen("http://www.gps-sport.net/services/trainingGPX.jsp?trainingID=%s&tz=-180" % (trid)) xml = etree.parse(req) @@ -43,6 +45,7 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False): for tr in training_list: filename = "%s/%04d/%02d/%s_%s.gpx" % (dir,year,(month+1),tr[0],tr[1]) + dirname = "%s/%04d/%02d" % (dir,year,(month+1)) if os.path.exists(filename) and not force: @@ -50,7 +53,12 @@ def sync_folder(username,year,month,dir=".",verbose=False,force=False): print "training %s exists, skipping" % (filename) else: - + + try: + os.makedirs(dirname) + except: + None + xml=get_gpx_track(tr[1],tr[0]) if verbose: