def get_image( self ): ''' Loop through each of the sample images, returning one image on each call and advancing for the next call. ''' path = Utils.get_absolute_path( 'images/{0}.jpg'.format( self.image_idx ) ) self.increment_idx() f = open( path, 'rb' ) b = f.read() f.close() return b
Main program for the surveillance server. Starts the CherryPy web engine and starts the media and web servers. ''' import cherrypy from surveillance.utils import Utils from surveillance.server import Server #========================================================================== # Configuration #========================================================================== server_ip = '192.168.2.47' web_port = 8080 media_port = 8081 web_static_dir_root = Utils.get_absolute_path( 'static/' ) web_static_dir_public = './public' database = 'surveillance.db' def main(): cherrypy.config.update({'server.socket_host' : server_ip, 'server.socket_port' : web_port}) hostmap = { '{0}:{1}'.format(server_ip, web_port) : '/webserver', '{0}:{1}'.format(server_ip, media_port) : '/mediaserver', } # Configure CherryPy for virtual host and static content. conf = { '/' :