small refinement upload
This commit is contained in:
@@ -114,10 +114,10 @@ class Command(BaseCommand):
|
|||||||
extension = attachment.document.name[-3:].lower()
|
extension = attachment.document.name[-3:].lower()
|
||||||
try:
|
try:
|
||||||
message = Message.objects.get(id=attachment.message_id)
|
message = Message.objects.get(id=attachment.message_id)
|
||||||
if message.text:
|
#if message.text:
|
||||||
body = "\n".join(message.text.splitlines())
|
# body = "\n".join(message.text.splitlines())
|
||||||
else:
|
#else:
|
||||||
body = message.body
|
body = message.get_body()
|
||||||
|
|
||||||
uploadoptions = uploads.upload_options(body)
|
uploadoptions = uploads.upload_options(body)
|
||||||
from_address = message.from_address[0].lower()
|
from_address = message.from_address[0].lower()
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ except:
|
|||||||
|
|
||||||
from rowers.utils import (
|
from rowers.utils import (
|
||||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||||
str2bool,range_to_color_hex,absolute
|
str2bool,range_to_color_hex,absolute,myqueue
|
||||||
)
|
)
|
||||||
|
|
||||||
def cleanbody(body):
|
def cleanbody(body):
|
||||||
@@ -51,10 +51,16 @@ def cleanbody(body):
|
|||||||
# currently only matches one chart
|
# currently only matches one chart
|
||||||
def matchchart(line):
|
def matchchart(line):
|
||||||
results = []
|
results = []
|
||||||
tester = VerEx().start_of_line().find('chart').OR().find('plot')
|
testert = '^((chart)|(plot))'
|
||||||
tester2 = VerEx().start_of_line().find('chart').OR().find('plot').anything().find('distance')
|
tester2t = testert+'(.*)(dist)'
|
||||||
tester3 = VerEx().start_of_line().find('chart').OR().find('plot').anything().find('time')
|
tester3t = testert+'(.*)(time)'
|
||||||
tester4 = VerEx().start_of_line().find('chart').OR().find('plot').anything().find('pie')
|
tester4t = testert+'(.*)(pie)'
|
||||||
|
|
||||||
|
tester = re.compile(testert)
|
||||||
|
tester2 = re.compile(tester2t)
|
||||||
|
tester3 = re.compile(tester3t)
|
||||||
|
tester4 = re.compile(tester4t)
|
||||||
|
|
||||||
if tester.match(line.lower()):
|
if tester.match(line.lower()):
|
||||||
if tester2.match(line.lower()):
|
if tester2.match(line.lower()):
|
||||||
return 'distanceplot'
|
return 'distanceplot'
|
||||||
@@ -262,15 +268,10 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
|||||||
if w.workouttype in ('water','coastal'):
|
if w.workouttype in ('water','coastal'):
|
||||||
plotnr = plotnr+3
|
plotnr = plotnr+3
|
||||||
|
|
||||||
|
|
||||||
if settings.DEBUG:
|
job = myqueue(queue,handle_makeplot,f1,f2,
|
||||||
job = handle_makeplot.delay(f1,f2,title,
|
title,hrpwrdata,
|
||||||
hrpwrdata,plotnr,
|
plotnr,imagename)
|
||||||
imagename)
|
|
||||||
else:
|
|
||||||
job = queue.enqueue(handle_makeplot,f1,f2,
|
|
||||||
title,hrpwrdata,
|
|
||||||
plotnr,imagename)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
width,height = Image.open(fullpathimagename).size
|
width,height = Image.open(fullpathimagename).size
|
||||||
|
|||||||
@@ -8620,7 +8620,11 @@ def workout_upload_view(request,
|
|||||||
|
|
||||||
r = getrower(request.user)
|
r = getrower(request.user)
|
||||||
if (make_plot):
|
if (make_plot):
|
||||||
id = uploads.make_plot(r,w,f1,f2,plottype,t)
|
res,jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||||
|
try:
|
||||||
|
request.session['async_tasks'] += [(jobid,'make_plot')]
|
||||||
|
except KeyError:
|
||||||
|
request.session['async_tasks'] = [(jobid,'make_plot')]
|
||||||
|
|
||||||
# upload to C2
|
# upload to C2
|
||||||
if (upload_to_c2):
|
if (upload_to_c2):
|
||||||
|
|||||||
Reference in New Issue
Block a user