-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideo_stream_server.py
35 lines (26 loc) · 1.16 KB
/
video_stream_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from flask import Flask, send_file, render_template
from util import get_edited_file_name_from_datetime, get_theft_time_list
app = Flask(__name__)
@app.route('/play/<market_id>/<t_stamp>')
def get(market_id, t_stamp):
t_stamp = str(t_stamp).replace('_', ' ')
fname = get_edited_file_name_from_datetime(t_stamp)
video_source = "/video/"+fname+".mp4"
return render_template('play_video.html', market=market_id, timestamp=t_stamp, video_src=video_source)
@app.route('/list/<market_id>')
def show_list(market_id):
timestamps = get_theft_time_list()
stamps = []
for t in timestamps:
stamps.append([f"/play/{str(market_id)}/{t.replace(' ', '_')}", t])
return render_template('timestamp_list.html', market=market_id, stamp_list = stamps)
@app.route('/video/<string:videoName>')
def video(videoName):
return send_file("./theft_videos/"+videoName)
@app.route('/test/<string:videoName>')
def video_test(videoName):
t_stamp = str(videoName).replace('_', ' ')
fname = get_edited_file_name_from_datetime(t_stamp)+".mp4"
return send_file("./theft_videos/"+fname)
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=5000)