Skip to content
Browse files

Changed total time to moving time

  • Loading branch information...
1 parent 0deb934 commit 583866209acc54bf40607d16281835af5e93a0f4 Erik committed
Showing with 12 additions and 10 deletions.
  1. +12 −10 code/python/fusionrunner/fusionrunner.py
View
22 code/python/fusionrunner/fusionrunner.py 100644 → 100755
@@ -105,7 +105,7 @@
distance_km = re.search(r'Total distance: (.*?) km', desc).group(1)
- total_time = re.search(r'Total time: (.*?)<br>', desc).group(1)
+ total_time = re.search(r'Moving time: (.*?)<br>', desc).group(1)
m = re.match(r'(\d+):(\d+):(\d+)|(\d+):(\d+)', total_time)
groups = [x for x in m.groups() if x != None]
if len(groups) == 2:
@@ -115,6 +115,7 @@
total_time = int(total_time.total_seconds() * 1000)
activity = re.search(r'Activity type: (\w+)', desc).group(1)
+ tagid = None
if activity == 'walking':
activity = 'Walk'
tagid = 2
@@ -131,12 +132,13 @@
if smashrun_response['status'] == "200":
print "Success"
- print "Tagging Run from %s..." % (start_date_time),
- match = re.search(r'"runId":(\d+)', smashrun_content)
- runid = int(match.group(1))
- smashrun_url = "http://smashrun.com/services/running-jsonservice.asmx/SaveRunTag"
- smashrun_body = '{"runId":%d,"tagId":%d,"text":"%s",untag:false}' % (runid, tagid, activity)
- smashrun_response, smashrun_content = smashrun_http.request(smashrun_url, 'POST',
- headers=smashrun_headers, body=smashrun_body)
- if smashrun_response['status'] == "200":
- print "Success"
+ if tagid != None:
+ print "Tagging Run from %s..." % (start_date_time),
+ match = re.search(r'"runId":(\d+)', smashrun_content)
+ runid = int(match.group(1))
+ smashrun_url = "http://smashrun.com/services/running-jsonservice.asmx/SaveRunTag"
+ smashrun_body = '{"runId":%d,"tagId":%d,"text":"%s",untag:false}' % (runid, tagid, activity)
+ smashrun_response, smashrun_content = smashrun_http.request(smashrun_url, 'POST',
+ headers=smashrun_headers, body=smashrun_body)
+ if smashrun_response['status'] == "200":
+ print "Success"

0 comments on commit 5838662

Please sign in to comment.
Something went wrong with that request. Please try again.