Private
Public Access
1
0

forgot to save

This commit is contained in:
Sander Roosendaal
2019-11-15 08:08:11 +01:00
parent ad3681723a
commit 47a6545eac

View File

@@ -48,12 +48,12 @@ def cleanbody(body):
body = body.decode('utf-8') body = body.decode('utf-8')
except AttributeError: except AttributeError:
pass pass
regex = r".*---\n([\s\S]*?)\.\.\..*" regex = r".*---\n([\s\S]*?)\.\.\..*"
matches = re.finditer(regex,body) matches = re.finditer(regex,body)
for m in matches: for m in matches:
if m != None: if m != None:
body = m.group(0) body = m.group(0)
@@ -112,7 +112,7 @@ def matchrace(line):
return None return None
return None return None
def matchsync(line): def matchsync(line):
results = [] results = []
tester = '((sync)|(synchronization)|(export))' tester = '((sync)|(synchronization)|(export))'
@@ -175,7 +175,7 @@ def gettypeoptions_body2(uploadoptions,body):
break break
return uploadoptions return uploadoptions
def getprivateoptions_body2(uploadoptions,body): def getprivateoptions_body2(uploadoptions,body):
tester = re.compile('^(priva)') tester = re.compile('^(priva)')
for line in body.splitlines(): for line in body.splitlines():
@@ -206,7 +206,7 @@ def getplotoptions_body2(uploadoptions,body):
if chart: if chart:
uploadoptions['make_plot'] = True uploadoptions['make_plot'] = True
uploadoptions['plottype'] = chart uploadoptions['plottype'] = chart
return uploadoptions return uploadoptions
def getuseroptions_body2(uploadoptions,body): def getuseroptions_body2(uploadoptions,body):
@@ -236,7 +236,7 @@ def getsyncoptions_body2(uploadoptions,body):
uploadoptions[r] = True uploadoptions[r] = True
return uploadoptions return uploadoptions
def getsyncoptions(uploadoptions,values): def getsyncoptions(uploadoptions,values):
try: try:
value = values.lower() value = values.lower()
@@ -247,7 +247,7 @@ def getsyncoptions(uploadoptions,values):
for v in values: for v in values:
try: try:
v = v.lower() v = v.lower()
if v in ['c2','concept2','logbook']: if v in ['c2','concept2','logbook']:
uploadoptions['upload_to_C2'] = True uploadoptions['upload_to_C2'] = True
if v in ['tp','trainingpeaks']: if v in ['tp','trainingpeaks']:
@@ -262,7 +262,7 @@ def getsyncoptions(uploadoptions,values):
uploadoptions['upload_to_MapMyFitness'] = True uploadoptions['upload_to_MapMyFitness'] = True
except AttributeError: except AttributeError:
pass pass
return uploadoptions return uploadoptions
def getplotoptions(uploadoptions,value): def getplotoptions(uploadoptions,value):
@@ -437,7 +437,7 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
if plotnr == 0: if plotnr == 0:
plotnr = plotnrs[plottype] plotnr = plotnrs[plottype]
if w.workouttype in otwtypes: if w.workouttype in otwtypes:
plotnr = plotnr+3 plotnr = plotnr+3
@@ -445,20 +445,20 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
job = myqueue(queuehigh,handle_makeplot,f1,f2, job = myqueue(queuehigh,handle_makeplot,f1,f2,
title,hrpwrdata, title,hrpwrdata,
plotnr,imagename) plotnr,imagename)
try: try:
width,height = Image.open(fullpathimagename).size width,height = Image.open(fullpathimagename).size
except: except:
width = 1200 width = 1200
height = 600 height = 600
imgs = GraphImage.objects.filter(workout=w) imgs = GraphImage.objects.filter(workout=w)
if len(imgs) < 7: if len(imgs) < 7:
i = GraphImage(workout=w, i = GraphImage(workout=w,
creationdatetime=timezone.now(), creationdatetime=timezone.now(),
filename=fullpathimagename, filename=fullpathimagename,
width=width,height=height) width=width,height=height)
i.save() i.save()
else: else:
return 0,'You have reached the maximum number of static images for this workout. Delete an image first' return 0,'You have reached the maximum number of static images for this workout. Delete an image first'
@@ -501,7 +501,7 @@ def make_private(w,options):
return 1 return 1
from rowers.utils import isprorower from rowers.utils import isprorower
def do_sync(w,options): def do_sync(w,options):
try: try:
if options['stravaid'] != 0: if options['stravaid'] != 0:
@@ -524,20 +524,21 @@ def do_sync(w,options):
if ('upload_to_Strava' in options and not options['upload_to_Strava']): if ('upload_to_Strava' in options and not options['upload_to_Strava']):
pass pass
else: else:
try: if options['stravaid'] != 0:
message,id = stravastuff.workout_strava_upload( try:
message,id = stravastuff.workout_strava_upload(
w.user.user,w w.user.user,w
) )
except NoTokenError: except NoTokenError:
id = 0 id = 0
message = "Please connect to Strava first" message = "Please connect to Strava first"
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and isprorower(w.user)): if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and isprorower(w.user)):
if ('upload_to_SportTracks' in options and not options['upload_to_SportTracks']): if ('upload_to_SportTracks' in options and not options['upload_to_SportTracks']):
pass pass
else: else:
try: try:
message,id = sporttracksstuff.workout_sporttracks_upload( message,id = sporttracksstuff.workout_sporttracks_upload(
w.user.user,w w.user.user,w
@@ -545,13 +546,13 @@ def do_sync(w,options):
except NoTokenError: except NoTokenError:
message = "Please connect to SportTracks first" message = "Please connect to SportTracks first"
id = 0 id = 0
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and isprorower(w.user)): if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and isprorower(w.user)):
if ('upload_to_RunKeeper' in options and not options['upload_to_RunKeeper']): if ('upload_to_RunKeeper' in options and not options['upload_to_RunKeeper']):
pass pass
else: else:
try: try:
message,id = runkeeperstuff.workout_runkeeper_upload( message,id = runkeeperstuff.workout_runkeeper_upload(
w.user.user,w w.user.user,w
@@ -559,11 +560,11 @@ def do_sync(w,options):
except NoTokenError: except NoTokenError:
message = "Please connect to Runkeeper first" message = "Please connect to Runkeeper first"
id = 0 id = 0
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and isprorower(w.user)): if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and isprorower(w.user)):
if ('upload_to_MapMyFitness' in options and not options['upload_to_MapMyFitness']): if ('upload_to_MapMyFitness' in options and not options['upload_to_MapMyFitness']):
pass pass
else: else:
try: try:
message,id = underarmourstuff.workout_ua_upload( message,id = underarmourstuff.workout_ua_upload(
w.user.user,w w.user.user,w
@@ -572,7 +573,7 @@ def do_sync(w,options):
message = "Please connect to MapMyFitness first" message = "Please connect to MapMyFitness first"
id = 0 id = 0
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and isprorower(w.user)): if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and isprorower(w.user)):
if ('upload_to_TrainingPeaks' in options and not options['upload_to_TrainingPeaks']): if ('upload_to_TrainingPeaks' in options and not options['upload_to_TrainingPeaks']):
pass pass