From e7110802693ae1901fa9e215375d34a9370b1cb0 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 2 May 2017 14:11:42 +0200 Subject: [PATCH] exports workout source to major fitness sites in notes --- rowers/c2stuff.py | 2 +- rowers/runkeeperstuff.py | 4 ++-- rowers/sporttracksstuff.py | 4 ++-- rowers/stravastuff.py | 2 +- rowers/tpstuff.py | 2 +- rowers/underarmourstuff.py | 2 +- rowers/views.py | 2 +- rowsandall_app/settings.py | 1 + 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/rowers/c2stuff.py b/rowers/c2stuff.py index 91a7493c..b73ca700 100644 --- a/rowers/c2stuff.py +++ b/rowers/c2stuff.py @@ -230,7 +230,7 @@ def createc2workoutdata_as_splits(w): "time": int(10*makeseconds(durationstr)), "timezone": "Etc/UTC", "weight_class": c2wc(w.weightcategory), - "comments": w.notes, + "comments": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "heart_rate": { "average": averagehr, "max": maxhr, diff --git a/rowers/runkeeperstuff.py b/rowers/runkeeperstuff.py index b845bf20..cadb1557 100644 --- a/rowers/runkeeperstuff.py +++ b/rowers/runkeeperstuff.py @@ -228,7 +228,7 @@ def createrunkeeperworkoutdata(w): "start_time": start_time, "total_distance": int(w.distance), "duration": duration, - "notes": w.notes, + "notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "average_heart_rate": averagehr, "path": locdata, "distance": distancedata, @@ -242,7 +242,7 @@ def createrunkeeperworkoutdata(w): "start_time": start_time, "total_distance": int(w.distance), "duration": duration, - "notes": w.notes, + "notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "avg_heartrate": averagehr, "distance": distancedata, "heart_rate": hrdata, diff --git a/rowers/sporttracksstuff.py b/rowers/sporttracksstuff.py index 0e15aca6..c6a33100 100644 --- a/rowers/sporttracksstuff.py +++ b/rowers/sporttracksstuff.py @@ -264,7 +264,7 @@ def createsporttracksworkoutdata(w): "start_time": w.startdatetime.isoformat(), "total_distance": int(w.distance), "duration": duration, - "notes": w.notes, + "notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "avg_heartrate": averagehr, "max_heartrate": maxhr, "location": locdata, @@ -280,7 +280,7 @@ def createsporttracksworkoutdata(w): "start_time": w.startdatetime.isoformat(), "total_distance": int(w.distance), "duration": duration, - "notes": w.notes, + "notes": w.notes+'\n from '+w.workoutsource+' via rowsandall.com', "avg_heartrate": averagehr, "max_heartrate": maxhr, "distance": distancedata, diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index 64c6c03e..e4669000 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -239,7 +239,7 @@ def createstravaworkoutdata(w): try: row = rowingdata(filename) tcxfilename = filename[:-4]+'.tcx' - row.exporttotcx(tcxfilename,notes=w.notes) + row.exporttotcx(tcxfilename,notes=w.notes+'\n from '+w.workoutsource+' via rowsandall.com') gzfilename = tcxfilename+'.gz' with file(tcxfilename,'rb') as inF: s = inF.read() diff --git a/rowers/tpstuff.py b/rowers/tpstuff.py index b61ce004..1c90d975 100644 --- a/rowers/tpstuff.py +++ b/rowers/tpstuff.py @@ -187,7 +187,7 @@ def createtpworkoutdata(w): try: row = rowingdata(filename) tcxfilename = filename[:-4]+'.tcx' - row.exporttotcx(tcxfilename,notes=w.notes) + row.exporttotcx(tcxfilename,notes=w.notes+'\n from '+w.workoutsource+' via rowsandall.com') return tcxfilename except: tcxfilename = 0 diff --git a/rowers/underarmourstuff.py b/rowers/underarmourstuff.py index ad393b7c..b58c7ec1 100644 --- a/rowers/underarmourstuff.py +++ b/rowers/underarmourstuff.py @@ -214,7 +214,7 @@ def createunderarmourworkoutdata(w): duration += w.duration.second duration += +1.0e-6*w.duration.microsecond name = w.name - notes = w.notes + notes = w.notes+'\n from '+w.workoutsource+' via rowsandall.com' # adding diff, trying to see if this is valid #t = row.df.ix[:,'TimeStamp (sec)'].values-10*row.df.ix[0,'TimeStamp (sec)'] diff --git a/rowers/views.py b/rowers/views.py index 40ffc06b..845fbff2 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -1314,7 +1314,7 @@ def workout_strava_upload_view(request,id=0): with open(tcxfile,'rb') as f: res,mes = stravastuff.handle_stravaexport(f,w.name, r.stravatoken, - description=w.notes) + description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com') if res==0: message = mes w.uploadedtostrava = -1 diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 498119b2..5adfaafd 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -215,6 +215,7 @@ LOGOUT_URL = '/logout/' C2_CLIENT_ID = CFG['c2_client_id'] C2_CLIENT_SECRET = CFG['c2_client_secret'] C2_REDIRECT_URI = "http://rowsandall.com/call_back" +#C2_REDIRECT_URI = "http://localhost:8000/call_back" # Strava