first attempts parsing yaml from messg body
This commit is contained in:
@@ -30,6 +30,7 @@ from rowingdata import summarydata,get_file_type
|
||||
|
||||
from scipy.signal import savgol_filter
|
||||
from rowers.mailprocessing import make_new_workout_from_email,send_confirm
|
||||
import rowers.uploads as uploads
|
||||
|
||||
def rdata(file,rower=rrower()):
|
||||
try:
|
||||
@@ -50,6 +51,8 @@ class Command(BaseCommand):
|
||||
extension = a.document.name[-3:].lower()
|
||||
donotdelete = 0
|
||||
m = Message.objects.get(id=a.message_id)
|
||||
body = m.text
|
||||
uploadoptions = uploads.upload_options(body)
|
||||
from_address = m.from_address[0].lower()
|
||||
name = m.subject
|
||||
cntr += 1
|
||||
|
||||
@@ -11,12 +11,51 @@ from rowers.tasks import (
|
||||
from rowers.models import GraphImage
|
||||
|
||||
import numpy as np
|
||||
import yaml
|
||||
import argparse
|
||||
import yamllint
|
||||
from subprocess import call
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except:
|
||||
from StringIO import StringIO
|
||||
|
||||
from rowers.utils import (
|
||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||
str2bool,range_to_color_hex,absolute
|
||||
)
|
||||
|
||||
#Configuration for argument parsing
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("path", help='File/Directory path to be examined', type=str)
|
||||
args = (parser.parse_args())
|
||||
|
||||
#The main loop
|
||||
|
||||
#Verify file is in YAML, if so save as dict then end
|
||||
#ignore = set([])
|
||||
#with open(args.path, "r") as f:
|
||||
# try:
|
||||
# yml = (yaml.load(f))
|
||||
# print yml
|
||||
# #If not yaml run through yamllint
|
||||
# except yaml.YAMLError as exc:
|
||||
# call(["yamllint","-f","parsable",args.path])
|
||||
|
||||
def upload_options(body):
|
||||
uploadoptions = {}
|
||||
# ok, a temp solution - write to temp file
|
||||
with open('temp.txt','w') as f:
|
||||
f.write(body)
|
||||
with open('temp.txt','r') as f:
|
||||
try:
|
||||
yml = (yaml.load(f))
|
||||
print yml
|
||||
except yaml.YAMLError as exc:
|
||||
call(["yamllint","-f","parsable",'temp.txt'])
|
||||
|
||||
return uploadoptions
|
||||
|
||||
def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
||||
if imagename == '':
|
||||
|
||||
Reference in New Issue
Block a user