每次刷新会用摄像头截一张图,然后返回(网上不是有一个页面一直挂着美国一个街头的摄像头嘛,很多人应该看过).随便写着玩的,所以没注意性能什么的.
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
#by:pako
#email:zealzpc@gmail.com
import os, re, sys,types
import time
import web
from VideoCapture import Device
urls = (
'/', 'index',
)
web.webapi.internalerror = web.debugerror
render = web.template.render('template/')
cam = Device()
picnum = 0
class index:
def GET(self):
picname = './static/%d.jpg'%(picnum)
cam.saveSnapshot('./static/image.jpg', timestamp=3, boldfont=1)
picnum +=1
return render.index()
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()