otw cp stuff not finished
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user