Example #1
0
def resubmit(key):
	try:
		mash = rdb_client.get('mashes', key)
		mash_model = MashMessage(mash['id'], mash['key'], mash['song1'], mash['song2'], mash['status'])
		logger.debug('resubmit mash:{0}'.format(mash_model))
		socket.send_json(convert_mash_to_zeromq_message(mash_model))
		return redirect(url_for('mash', key=mash_model.key))
	except Exception, err:
		logger.exception('Something bad happened: resubmit, key={0}'.format(key))
Example #2
0
def home():
	if request.method == 'POST':
		try:
			key = uuid.uuid4().hex
			song1 = request.files['song1']
			song1Filename = save_file(song1, key)
			song2 = request.files['song2']
			song2Filename = save_file(song2, key)
			status = 'uploaded'
			mash = MashMessage(key, key, song1Filename, song2Filename, status)
			rdb_client.insert('mashes', {'id':key, 'key': key, 'song1': song1Filename, 'song2': song2Filename, 'status': status})
			logger.debug('new mash:{0}'.format(mash))
			socket.send_json(convert_mash_to_zeromq_message(mash))
			return redirect(url_for('mash', key=mash.key))
		except Exception, err:
			logger.exception('Something bad happened:')