Private
Public Access
1
0

otw cp stuff not finished

This commit is contained in:
Sander Roosendaal
2017-06-02 20:28:12 +02:00
parent dae5897b6a
commit 4e8b7e02b1
6 changed files with 369 additions and 15 deletions

View File

@@ -245,7 +245,7 @@ def get_strava_workout(user,stravaid):
return [workoutsummary,df]
# Generate Workout data for Strava (a TCX file)
def createstravaworkoutdata(w):
def createstravaworkoutdata(w,dozip=True):
filename = w.csvfilename
row = rowingdata(filename)
@@ -256,18 +256,22 @@ def createstravaworkoutdata(w):
newnotes = 'from '+w.workoutsource+' via rowsandall.com'
row.exporttotcx(tcxfilename,notes=newnotes)
gzfilename = tcxfilename+'.gz'
with file(tcxfilename,'rb') as inF:
s = inF.read()
with gzip.GzipFile(gzfilename,'wb') as outF:
outF.write(s)
if dozip:
gzfilename = tcxfilename+'.gz'
with file(tcxfilename,'rb') as inF:
s = inF.read()
with gzip.GzipFile(gzfilename,'wb') as outF:
outF.write(s)
try:
os.remove(tcxfilename)
except WindowError:
pass
return gzfilename,""
try:
os.remove(tcxfilename)
except WindowError:
pass
return gzfilename,""
else:
return tcxfilename,""
# Upload the TCX file to Strava and set the workout activity type