def editor(session_id): if request.method == 'GET': frames = YouGIF.get_frames(session_id) return render_template('editor.html', frames=frames) if request.method == 'POST': filename = YouGIF.generate_gif(session_id, request.json) return url_for('finish', session_id=session_id)
def index(): if request.method == 'GET': return render_template('index.html') if request.method == 'POST': session_id = str(uuid.uuid4()).replace('-', '') YouGIF.download_movie(request.form['url'], session_id) return redirect(url_for('editor', session_id=session_id))
def add_image(session_id, filename): filename = secure_filename(filename) image_data = YouGIF.add_image(session_id, request.data, filename) image_data['url'] = url_for('file_upload', session_id=session_id, filename=filename) return json.dumps(image_data)