Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. @app.route('/_saveEDL', methods=['GET','POST'])
  2. def saveEDL():
  3.  
  4.   if request.method == 'POST':
  5.     jsonData = request.json
  6.     columns = ['#','In','Out','Notes']
  7.  
  8.     if session['username'] in os.listdir(os.curdir + '/mysite/static/edl/'):
  9.       pass
  10.     else:
  11.       os.mkdir(os.curdir + '/mysite/static/edl/' + session['username'])
  12.  
  13.     with open(os.curdir + '/mysite/static/edl/' + session['username'] + '/' + str(datetime.datetime.now())[:19].replace(':','') + '-' + session['username'] + '-EDL.csv', 'w') as edl:
  14.       typer = csv.writer(edl)
  15.       typer.writerow(columns)
  16.       i = 1
  17.       for x in jsonData['edits']:
  18.         tempRow = []
  19.         tempRow.append(i)
  20.         tempRow.append(x['inPoint'])
  21.         tempRow.append(x['outPoint'])
  22.         try:
  23.           tempRow.append(x['note'])
  24.         except:
  25.           tempRow.append('')
  26.         typer.writerow(tempRow)
  27.         i += 1
  28.       edl.close()
  29.     session['downloadEDL'] = True
  30.     return redirect(url_for('index'))
  31.   return redirect(url_for('index'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement