added sync options
This commit is contained in:
@@ -176,3 +176,64 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
i.save()
|
||||
|
||||
return i.id
|
||||
|
||||
import c2stuff,stravastuff,sporttracksstuff,runkeeperstuff
|
||||
import underarmourstuff,tpstuff
|
||||
|
||||
def do_sync(w,options):
|
||||
if 'upload_to_C2' in options and options['upload_to_C2']:
|
||||
try:
|
||||
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
||||
except C2NoTokenError:
|
||||
id = 0
|
||||
message = "Something went wrong with the Concept2 sync"
|
||||
|
||||
if 'upload_to_Strava' in options and options['upload_to_Strava']:
|
||||
try:
|
||||
message,id = stravastuff.workout_strava_upload(
|
||||
w.user.user,w
|
||||
)
|
||||
except StravaNoTokenError:
|
||||
id = 0
|
||||
message = "Please connect to Strava first"
|
||||
|
||||
|
||||
if 'upload_to_SportTracks' in options and options['upload_to_SportTracks']:
|
||||
try:
|
||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||
w.user.user,w
|
||||
)
|
||||
except SportTracksNoTokenError:
|
||||
message = "Please connect to SportTracks first"
|
||||
id = 0
|
||||
|
||||
|
||||
if 'upload_to_RunKeeper' in options and options['upload_to_RunKeeper']:
|
||||
try:
|
||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||
w.user.user,w
|
||||
)
|
||||
except RunKeeperNoTokenError:
|
||||
message = "Please connect to Runkeeper first"
|
||||
id = 0
|
||||
|
||||
if 'upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']:
|
||||
try:
|
||||
message,id = underarmourstuff.workout_ua_upload(
|
||||
w.user.user,w
|
||||
)
|
||||
except UnderArmourNoTokenError:
|
||||
message = "Please connect to MapMyFitness first"
|
||||
id = 0
|
||||
|
||||
|
||||
if 'upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']:
|
||||
try:
|
||||
message,id = tpstuff.workout_tp_upload(
|
||||
w.user.user,w
|
||||
)
|
||||
except TPNoTokenError:
|
||||
message = "Please connect to TrainingPeaks first"
|
||||
id = 0
|
||||
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user