emailprocessing stops in a controlled way
This commit is contained in:
@@ -847,52 +847,65 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
def handle_nonpainsled(f2, fileformat, summary=''):
|
def handle_nonpainsled(f2, fileformat, summary=''):
|
||||||
oarlength = 2.89
|
oarlength = 2.89
|
||||||
inboard = 0.88
|
inboard = 0.88
|
||||||
|
hasrecognized = False
|
||||||
# handle RowPro:
|
# handle RowPro:
|
||||||
if (fileformat == 'rp'):
|
if (fileformat == 'rp'):
|
||||||
row = RowProParser(f2)
|
row = RowProParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
# handle TCX
|
# handle TCX
|
||||||
if (fileformat == 'tcx'):
|
if (fileformat == 'tcx'):
|
||||||
row = TCXParser(f2)
|
row = TCXParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle Mystery
|
# handle Mystery
|
||||||
if (fileformat == 'mystery'):
|
if (fileformat == 'mystery'):
|
||||||
row = MysteryParser(f2)
|
row = MysteryParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle RowPerfect
|
# handle RowPerfect
|
||||||
if (fileformat == 'rowperfect3'):
|
if (fileformat == 'rowperfect3'):
|
||||||
row = RowPerfectParser(f2)
|
row = RowPerfectParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle ErgData
|
# handle ErgData
|
||||||
if (fileformat == 'ergdata'):
|
if (fileformat == 'ergdata'):
|
||||||
row = ErgDataParser(f2)
|
row = ErgDataParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle CoxMate
|
# handle CoxMate
|
||||||
if (fileformat == 'coxmate'):
|
if (fileformat == 'coxmate'):
|
||||||
row = CoxMateParser(f2)
|
row = CoxMateParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle Mike
|
# handle Mike
|
||||||
if (fileformat == 'bcmike'):
|
if (fileformat == 'bcmike'):
|
||||||
row = BoatCoachAdvancedParser(f2)
|
row = BoatCoachAdvancedParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle BoatCoach
|
# handle BoatCoach
|
||||||
if (fileformat == 'boatcoach'):
|
if (fileformat == 'boatcoach'):
|
||||||
row = BoatCoachParser(f2)
|
row = BoatCoachParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle BoatCoach OTW
|
# handle BoatCoach OTW
|
||||||
if (fileformat == 'boatcoachotw'):
|
if (fileformat == 'boatcoachotw'):
|
||||||
row = BoatCoachOTWParser(f2)
|
row = BoatCoachOTWParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle painsled desktop
|
# handle painsled desktop
|
||||||
if (fileformat == 'painsleddesktop'):
|
if (fileformat == 'painsleddesktop'):
|
||||||
row = painsledDesktopParser(f2)
|
row = painsledDesktopParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle speed coach GPS
|
# handle speed coach GPS
|
||||||
if (fileformat == 'speedcoach'):
|
if (fileformat == 'speedcoach'):
|
||||||
row = speedcoachParser(f2)
|
row = speedcoachParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle speed coach GPS 2
|
# handle speed coach GPS 2
|
||||||
if (fileformat == 'speedcoach2'):
|
if (fileformat == 'speedcoach2'):
|
||||||
row = SpeedCoach2Parser(f2)
|
row = SpeedCoach2Parser(f2)
|
||||||
|
hasrecognized = True
|
||||||
try:
|
try:
|
||||||
oarlength, inboard = get_empower_rigging(f2)
|
oarlength, inboard = get_empower_rigging(f2)
|
||||||
summary = row.allstats()
|
summary = row.allstats()
|
||||||
@@ -902,10 +915,12 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
|||||||
# handle ErgStick
|
# handle ErgStick
|
||||||
if (fileformat == 'ergstick'):
|
if (fileformat == 'ergstick'):
|
||||||
row = ErgStickParser(f2)
|
row = ErgStickParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
|
|
||||||
# handle FIT
|
# handle FIT
|
||||||
if (fileformat == 'fit'):
|
if (fileformat == 'fit'):
|
||||||
row = FITParser(f2)
|
row = FITParser(f2)
|
||||||
|
hasrecognized = True
|
||||||
try:
|
try:
|
||||||
s = fitsummarydata(f2)
|
s = fitsummarydata(f2)
|
||||||
s.setsummary()
|
s.setsummary()
|
||||||
@@ -913,6 +928,13 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Handle c2log
|
||||||
|
if (fileformat == 'c2log' or fileformat == 'rowprolog'):
|
||||||
|
return (0,0,0,0)
|
||||||
|
|
||||||
|
if not hasrecognized:
|
||||||
|
return (0,0,0,0)
|
||||||
|
|
||||||
f_to_be_deleted = f2
|
f_to_be_deleted = f2
|
||||||
# should delete file
|
# should delete file
|
||||||
f2 = f2[:-4] + 'o.csv'
|
f2 = f2[:-4] + 'o.csv'
|
||||||
@@ -971,7 +993,7 @@ def new_workout_from_file(r, f2,
|
|||||||
# Some people try to upload Concept2 logbook summaries
|
# Some people try to upload Concept2 logbook summaries
|
||||||
if fileformat == 'c2log':
|
if fileformat == 'c2log':
|
||||||
os.remove(f2)
|
os.remove(f2)
|
||||||
message = "This C2 logbook summary does not contain stroke data. Please download the Export Stroke Data file from the workout details on the C2 logbook."
|
message = "This summary does not contain stroke data. Use the files containing stroke by stroke data."
|
||||||
return (0, message, f2)
|
return (0, message, f2)
|
||||||
|
|
||||||
if fileformat == 'nostrokes':
|
if fileformat == 'nostrokes':
|
||||||
@@ -1021,14 +1043,16 @@ def new_workout_from_file(r, f2,
|
|||||||
return (0, message, '')
|
return (0, message, '')
|
||||||
|
|
||||||
dosummary = (fileformat != 'fit')
|
dosummary = (fileformat != 'fit')
|
||||||
id, message = save_workout_database(f2, r,
|
id, message = save_workout_database(
|
||||||
workouttype=workouttype,
|
f2, r,
|
||||||
makeprivate=makeprivate,
|
workouttype=workouttype,
|
||||||
dosummary=dosummary,
|
makeprivate=makeprivate,
|
||||||
workoutsource=fileformat,
|
dosummary=dosummary,
|
||||||
summary=summary,
|
workoutsource=fileformat,
|
||||||
inboard=inboard, oarlength=oarlength,
|
summary=summary,
|
||||||
title=title)
|
inboard=inboard, oarlength=oarlength,
|
||||||
|
title=title
|
||||||
|
)
|
||||||
|
|
||||||
return (id, message, f2)
|
return (id, message, f2)
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0):
|
|||||||
if fileformat != 'csv':
|
if fileformat != 'csv':
|
||||||
filename_mediadir, summary, oarlength, inboard = dataprep.handle_nonpainsled(
|
filename_mediadir, summary, oarlength, inboard = dataprep.handle_nonpainsled(
|
||||||
'media/' + datafilename, fileformat, summary)
|
'media/' + datafilename, fileformat, summary)
|
||||||
|
if not filename_mediadir:
|
||||||
|
return 0
|
||||||
else:
|
else:
|
||||||
filename_mediadir = 'media/' + datafilename
|
filename_mediadir = 'media/' + datafilename
|
||||||
inboard = 0.88
|
inboard = 0.88
|
||||||
|
|||||||
Reference in New Issue
Block a user