@app.route('/identify') def index(): params = ujson.loads(request.body) source_file = params.get('source_file') target_file = params.get('target_file') packet = {"source_file": source_file, "target_file": target_file} # Popen call ffprobe -i input.file -show_format -v quiet | sed -n 's/duration=//p' # calculate time slices and send time_slices = 5 # XXX ### transcode request for i in xrange(0, time_slices): new_packet = {} br_sock.send(new_packet) @app.route('/resume') def index(): params = ujson.loads(request.body) # Popen call cat intermediate1.mpg intermediate2.mpg # send done br_sock.send(make_register_packet()) server = WSGIServer(('127.0.0.1', 7001), app, spawn_type=Process) server.serve_forever()
def main(): server = WSGIServer(('127.0.0.1', 7000), app) print server server.serve_forever()