else:
            return
        return


if __name__ == "__main__":
    global grabber, log, package_pool
    grabber = set_proxy()
    log = set_logging()

    # If XMLRPCServer is running already, don't start it again
    try:
        time.sleep(int(random.random() * 100) % 10)
        package_pool = ServerProxy("http://" + rpc_host + ":" + str(rpc_port))
        list = package_pool.get()
        # Flush previous values on reload
        package_pool.flush()
        # For testing with squid, use this function
        squid_part()
    except:
        # Start XMLRPC Server, Download Scheduler and Base Plugin in threads.
        thread_xmlrpc = Function_Thread(XMLRPC_SERVER)
        thread_download_scheduler = Function_Thread(DOWNLOAD_SCHEDULER)
        thread_base_plugin = Function_Thread(BASE_PLUGIN)
        thread_xmlrpc.start()
        thread_download_scheduler.start()
        thread_base_plugin.start()
        thread_xmlrpc.join()
        thread_download_scheduler.join()
        thread_base_plugin.join()
Ejemplo n.º 2
0
if __name__ == '__main__':
    global log
    log = set_logging()
    try:
        log_rotate()
    except:
        log(format%(os.getpid(), '-', '-', 'LOG_ROTATE_ERR', '-', 'Could not rotate logfiles.'))

    if log is not None:
        # If XMLRPCServer is running already, don't start it again
        try:
            time.sleep(random.random()*100%7)
            video_id_pool = ServerProxy('http://' + rpc_host + ':' + str(rpc_port))
            # Flush previous values on reload
            video_id_pool.flush()
            # For testing with squid, use this function
            squid_part()
        except:
            # Start XMLRPC Server, Download Scheduler and Base Plugin in threads.
            thread_xmlrpc = Function_Thread(XMLRPC_SERVER)
            thread_download_scheduler = Function_Thread(DOWNLOAD_SCHEDULER)
            thread_base_plugin = Function_Thread(BASE_PLUGIN)
            thread_xmlrpc.start()
            thread_download_scheduler.start()
            thread_base_plugin.start()
            thread_xmlrpc.join()
            thread_download_scheduler.join()
            thread_base_plugin.join()