|
@@ -15,23 +15,45 @@ d=db()
|
|
|
def index():
|
|
def index():
|
|
|
return "Hello world"
|
|
return "Hello world"
|
|
|
|
|
|
|
|
|
|
+@app.route(BASE_PATH + '/list/yt/')
|
|
|
|
|
+@app.route(BASE_PATH + '/list/yt')
|
|
|
|
|
+def uploaded_list():
|
|
|
|
|
+ ret={'list': d.uploaded()}
|
|
|
|
|
+ return jsonify(ret)
|
|
|
|
|
+
|
|
|
@app.route(BASE_PATH + '/list/raw/')
|
|
@app.route(BASE_PATH + '/list/raw/')
|
|
|
@app.route(BASE_PATH + '/list/raw')
|
|
@app.route(BASE_PATH + '/list/raw')
|
|
|
def raw_list():
|
|
def raw_list():
|
|
|
ret={'list': d.raw() }
|
|
ret={'list': d.raw() }
|
|
|
return jsonify(ret)
|
|
return jsonify(ret)
|
|
|
|
|
|
|
|
-@app.route(BASE_PATH + '/raw/<video_id>')
|
|
|
|
|
-def raw_file(video_id):
|
|
|
|
|
- ret=d.raw(video_id)
|
|
|
|
|
- ret["file"]=ret["file"].split("front")[1] #FIXME, path relativo al webserver
|
|
|
|
|
- return jsonify(ret)
|
|
|
|
|
-
|
|
|
|
|
@app.route(BASE_PATH + '/list/processed/')
|
|
@app.route(BASE_PATH + '/list/processed/')
|
|
|
@app.route(BASE_PATH + '/list/processed')
|
|
@app.route(BASE_PATH + '/list/processed')
|
|
|
def processed_list():
|
|
def processed_list():
|
|
|
ret={'list': d.processed() }
|
|
ret={'list': d.processed() }
|
|
|
return jsonify(ret)
|
|
return jsonify(ret)
|
|
|
|
|
+
|
|
|
|
|
+@app.route(BASE_PATH + '/list/jobs/')
|
|
|
|
|
+@app.route(BASE_PATH + '/list/jobs')
|
|
|
|
|
+def jobs():
|
|
|
|
|
+ working = tasks.jobs()
|
|
|
|
|
+ return json.dumps({"working":working})
|
|
|
|
|
+
|
|
|
|
|
+@app.route(BASE_PATH + '/raw/<video_id>')
|
|
|
|
|
+def raw_file(video_id):
|
|
|
|
|
+ ret=d.raw(video_id)
|
|
|
|
|
+ print(ret)
|
|
|
|
|
+ if ret is not None:
|
|
|
|
|
+ ret["file"]=ret["file"].split("front")[1] #FIXME, path relativo al webserver
|
|
|
|
|
+ return jsonify(ret)
|
|
|
|
|
+ return "{}"
|
|
|
|
|
+
|
|
|
|
|
+@app.route(BASE_PATH + '/processed/<video_id>')
|
|
|
|
|
+def processed_file(video_id):
|
|
|
|
|
+ ret=d.processed(video_id)
|
|
|
|
|
+ ret["out_fname"]=ret["out_fname"].split("front")[1] #FIXME, path relativo al webserver
|
|
|
|
|
+ return jsonify(ret)
|
|
|
|
|
+
|
|
|
@app.route(BASE_PATH + '/crop/', methods=["POST"])
|
|
@app.route(BASE_PATH + '/crop/', methods=["POST"])
|
|
|
def crop():
|
|
def crop():
|
|
|
ret={"status":"Procesando"}
|
|
ret={"status":"Procesando"}
|
|
@@ -43,30 +65,31 @@ def crop():
|
|
|
today.strftime('%Y%m%d'),
|
|
today.strftime('%Y%m%d'),
|
|
|
data["desc"])
|
|
data["desc"])
|
|
|
|
|
|
|
|
|
|
+ #job = tasks.crop_video.delay(video["file"],
|
|
|
job = tasks.jobrunner(tasks.crop_video,
|
|
job = tasks.jobrunner(tasks.crop_video,
|
|
|
(video["file"],
|
|
(video["file"],
|
|
|
str(data["inicio"]),
|
|
str(data["inicio"]),
|
|
|
str(data["fin"]),
|
|
str(data["fin"]),
|
|
|
out_filename,))
|
|
out_filename,))
|
|
|
- #job = tasks.crop_video.delay(video["file"],
|
|
|
|
|
- # str(data["inicio"]),
|
|
|
|
|
- # str(data["fin"]),
|
|
|
|
|
- # out_filename)
|
|
|
|
|
ret["job_id"]=job.get_id()
|
|
ret["job_id"]=job.get_id()
|
|
|
return jsonify(ret)
|
|
return jsonify(ret)
|
|
|
|
|
|
|
|
-@app.route(BASE_PATH + '/list/jobs/')
|
|
|
|
|
-@app.route(BASE_PATH + '/list/jobs')
|
|
|
|
|
-def jobs():
|
|
|
|
|
- working = tasks.jobs()
|
|
|
|
|
- finished = d.getJobs()
|
|
|
|
|
- return json.dumps({"working":working, "finished":finished})
|
|
|
|
|
|
|
+@app.route(BASE_PATH + '/upload/', methods=["POST"])
|
|
|
|
|
+def upload():
|
|
|
|
|
+ ret={"status":"Procesando"}
|
|
|
|
|
+ today=datetime.date.today()
|
|
|
|
|
+ data = request.get_json()
|
|
|
|
|
+ video=data["id"]
|
|
|
|
|
+ prof=data["prof"]
|
|
|
|
|
+ texto1=data["texto1"]
|
|
|
|
|
+ texto2=data["texto2"]
|
|
|
|
|
+ tasks.upload_video(video,prof,texto1,texto2)
|
|
|
|
|
+ return jsonify(ret)
|
|
|
|
|
|
|
|
@app.route(BASE_PATH + '/job')
|
|
@app.route(BASE_PATH + '/job')
|
|
|
def job():
|
|
def job():
|
|
|
job = tasks.jobrunner(tasks.long_job, ("test",))
|
|
job = tasks.jobrunner(tasks.long_job, ("test",))
|
|
|
#job = tasks.long_job.delay("test")
|
|
#job = tasks.long_job.delay("test")
|
|
|
-# job = tasks.upload_video.delay("titulo","/home/david/photo_2016-07-10_13-49-56.jpg","/home/david/movie-1467033043.flv")
|
|
|
|
|
|
|
|
|
|
ret = {"id":job.get_id()}
|
|
ret = {"id":job.get_id()}
|
|
|
|
|
|
|
@@ -83,10 +106,6 @@ def get_results(job_key):
|
|
|
return ret
|
|
return ret
|
|
|
|
|
|
|
|
|
|
|
|
|
-@app.route(BASE_PATH + '/uploaded')
|
|
|
|
|
-def uploaded_list():
|
|
|
|
|
- ret=[]
|
|
|
|
|
- return jsonify(ret)
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
|
app.run(host="0.0.0.0",port=PORT, debug=True)
|
|
app.run(host="0.0.0.0",port=PORT, debug=True)
|