我有这个python脚本代码,我在apache中使用wsgi模块。表有id和video_文件名。在
video_filename每行包含一个文件名。每个文件名都是一个视频文件名。视频文件名的扩展名为.mp4。例如:
ID视频_文件名
........
4视频4.mp4
3视频3.mp4
2视频2.mp4
1个视频1.mp4
在我的数据库表中,视频的数量每天都会自动增加。这已经在我已经完成的其他脚本中完成了。在
使用这个python脚本,我显示了一个ID为video文件名的表。在import sqlite3
def application(environ, start_response):
db = sqlite3.connect('/var/www/html/table.db')
db.row_factory = sqlite3.Row
cursor = db.cursor()
cursor.execute('''SELECT id, video_filename FROM table ORDER BY id DESC''')
results = ['
for row in cursor:
results.append('
')results.append('
{0}'.format(row['id']))results.append('
{0}'.format(row['video_filename'])results.append('
')db.close()
results.append('
')headers = [
('Content-Type', 'text/html; charset=utf-8'),
('Content-Length', str(sum(len(line) for line in results)))
]
start_response('200 OK', headers)
return results
这个代码有效。在
我想要的只是当用户点击一个特定的视频文件名时才显示一个视频。我知道我必须使用HTML5视频控制器标签。但我不知道怎么做。在
文件名视频记录在数据库中,但也保存在/var/www/html/中
例如:
/var/www/html/video1.mp4
有什么帮助吗?在
我很高兴当我点击链接显示特定的视频文件名弹出。当我关闭视频然后回到表id video_filename之前。在