|
|
每次刷新会用摄像头截一张图,然后返回(网上不是有一个页面一直挂着美国一个街头的摄像头嘛,很多人应该看过).随便写着玩的,所以没注意性能什么的.
#! /usr/bin/env python# -*- coding: UTF-8 -*-#by:pako#email:zealzpc@gmail.comimport os, re, sys,typesimport timeimport webfrom VideoCapture import Deviceurls = ( '/', 'index', )web.webapi.internalerror = web.debugerrorrender = web.template.render('template/')cam = Device()picnum = 0class 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() |
|