Exemplo n.º 1
0
def main():

    queue = PriorityQueue()

    for x in range(WORKERS):
        w = Worker(queue)
        w.start()

    settings = {"unblock_workers": 5}
    Application(settings)
    PyMongoDriver(host="127.0.0.1",
                  port=27017,
                  user="******",
                  password="******",
                  database="pipeline").register()

    test = False
    if test:
        FrameworkTest().run()
        # FrameworkTestThread().start()

    else:

        port = 9999

        StreamManagement(port)

        web_api = Web(port)
        web_api.start()

        Terminal().start()
Exemplo n.º 2
0
def main():
    # Init framework
    Application({})

    # Run the example code
    book = ReadingBook(content="This is content")
    book.read(respond=lambda result: print(result))
Exemplo n.º 3
0
    def __init__(self):
        if issubclass(self.__class__, Thread):
            Thread.__init__(self)

        if not hasattr(self, "context"):
            self.context = None
        else:
            if self.context is not None:
                logging.getLogger('system').debug("Initializing context "+self.context)

        Application().register_object(self)
Exemplo n.º 4
0
def main():

    settings = {
        "unblock_workers": 0
    }
    Application(settings)
    PyMongoDriver(
        host="127.0.0.1",
        port=27017,
        user="******",
        password="******",
        database="pipeline").register()

    icecast = IcecastHandler()
    icecast.parse_icecastxml("/etc/icecast2/icecast.xml")
    icecast.update_from_icecast()
    icecast.register_streams(icecast.get_streams())

    web = Web(8888, icecast)
    web.run()
Exemplo n.º 5
0
 def add_method(self, method):
     Application().settings["methods"].append(method)
Exemplo n.º 6
0
 def add_attribute(self, key, value):
     Application().settings["attributes"].append((key, value))
Exemplo n.º 7
0
 def add_settings_variable(self, key, value):
     Application().settings[key] = value