def main(): server = webgram.BareServer() web = tornado.web.Application([ (r"/watch/", server.get_streamer()), ]) web.listen(server.config.PORT, server.config.HOST) tornado.ioloop.IOLoop.current().start()
def start(app, port: int): web = tornado.web.Application([ (r"/api/v1/remote", RemoteHandler, dict(app=app)), ], default_handler_class=DefaultHandler) web.listen(port) logging.info("HTTP Server started on %d", port) tornado.ioloop.IOLoop.current().start()
def start(port: int): web = tornado.web.Application([ (r"/api/v1/ir", IRHandler), ], default_handler_class=DefaultHandler) web.listen(port) logging.info("HTTP Server started on %d", port) tornado.ioloop.IOLoop.current().start()
def start(port: int): web = tornado.web.Application([ (r"/api/v1/health", HealthHandler), ], default_handler_class=DefaultHandler) web.listen(port) logging.info("Started HTTP Server on %d", int(port)) tornado.ioloop.IOLoop.current().start()
def start(port: int, gpio: int): web = tornado.web.Application([ (r"/api/v1/ir", IRHandler, dict(gpio=gpio)), (r"/api/v1/sensors", SensorHandler), ], default_handler_class=DefaultHandler) web.listen(port) logging.info("HTTP Server started on %d", int(port)) tornado.ioloop.IOLoop.current().start()
import tornado.web import tornado.ioloop import logging import webgram import os if __name__ == "__main__": logging.basicConfig(level=logging.INFO) server = webgram.BareServer() web = tornado.web.Application([ (r"/m3u/", server.get_m3u_generator()), (r"/watch/", server.get_stream_watch()), (r"/", server.get_homepage()), ]) web.listen(server.config.PORT, server.config.HOST) os.dup2(os.open(os.devnull, os.O_RDWR), 2) tornado.ioloop.IOLoop.current().start()