server/main.py
def start(self):
        """
        This function will start all necessary components.
        Let's go :-D
        """
        # We need a lock to prevent too fast saving and loading actions of the config
        self._config_lock = Lock()

        # Create the instance of the config
        self._config_instance = ConfigService.instance(self._config_lock)
        self._config = self._config_instance.config

        self.logger = logging.getLogger(__name__)
        self.logger.info("Initializing MLSC...")

        # Check config compatibility
        self._config_instance.check_compatibility()

        # Prepare the queue for the output
        self._output_queue = Queue(2)
        self._effects_queue = Queue(100)
        self._audio_queue = Queue(2)

        # Prepare all notification queues
        self._notification_queue_audio_in = Queue(100)
        self._notification_queue_audio_out = Queue(100)

        self._notification_queue_device_manager_in = Queue(100)
        self._notification_queue_device_manager_out = Queue(100)

        self._notification_queue_webserver_in = Queue(100)
        self._notification_queue_webserver_out = Queue(100)

        # Start the DeviceManager Service
        self._device_manager = DeviceManager()
        self._device_manager_process = Process(
            target=self._device_manager.start,
            args=(
                self._config_lock,
                self._notification_queue_device_manager_in,
                self._notification_queue_device_manager_out,
                self._effects_queue,
                self._audio_queue,
            ))
        self._device_manager_process.start()

        # Start Notification Service
        self._notification_service = NotificationService()
        self._notification_service_process = Process(
            target=self._notification_service.start,
            args=(
                self._config_lock,
                self._notification_queue_device_manager_in,
                self._notification_queue_device_manager_out,
                self._notification_queue_audio_in,
                self._notification_queue_audio_out,
                self._notification_queue_webserver_in,
                self._notification_queue_webserver_out,
            ))
        self._notification_service_process.start()

        # Start Webserver
        self._webserver = Webserver()
        self._webserver_process = Process(
            target=self._webserver.start,
            args=(
                self._config_lock,
                self._notification_queue_webserver_in,
                self._notification_queue_webserver_out,
                self._effects_queue
            ))
        self._webserver_process.start()

        # Start audio process
        self._audio = AudioProcessService()
        self._audio_process = Process(
            target=self._audio.start,
            args=(
                self._config_lock,
                self._notification_queue_audio_in,
                self._notification_queue_audio_out,
                self._audio_queue
            ))
        self._audio_process.start()

        self.logger.info("Initialization finished.")

        try:
            self.logger.info("MLSC started...")

            self._cancel_token = False

            # Do nothing with this thread. Just wait for the exit.
            while not self._cancel_token:
                sleep(10)

        except KeyboardInterrupt:
            self.logger.info("Stopping MLSC...")
            self._notification_service_process.terminate()
            self._webserver_process.terminate()
            self.logger.info("MLSC stopped")

        This function will start all necessary components.
        Let's go :-D
        
This function will start all necessary components.
Let's go :-D
This function will start all necessary components . Let ' s go : - D
def start(self):
        self._config_lock = Lock()
        self._config_instance = ConfigService.instance(self._config_lock)
        self._config = self._config_instance.config
        self.logger = logging.getLogger(__name__)
        self.logger.info("Initializing MLSC...")
        self._config_instance.check_compatibility()
        self._output_queue = Queue(2)
        self._effects_queue = Queue(100)
        self._audio_queue = Queue(2)
        self._notification_queue_audio_in = Queue(100)
        self._notification_queue_audio_out = Queue(100)
        self._notification_queue_device_manager_in = Queue(100)
        self._notification_queue_device_manager_out = Queue(100)
        self._notification_queue_webserver_in = Queue(100)
        self._notification_queue_webserver_out = Queue(100)
        self._device_manager = DeviceManager()
        self._device_manager_process = Process(
            target=self._device_manager.start,
            args=(
                self._config_lock,
                self._notification_queue_device_manager_in,
                self._notification_queue_device_manager_out,
                self._effects_queue,
                self._audio_queue,
            ))
        self._device_manager_process.start()
        self._notification_service = NotificationService()
        self._notification_service_process = Process(
            target=self._notification_service.start,
            args=(
                self._config_lock,
                self._notification_queue_device_manager_in,
                self._notification_queue_device_manager_out,
                self._notification_queue_audio_in,
                self._notification_queue_audio_out,
                self._notification_queue_webserver_in,
                self._notification_queue_webserver_out,
            ))
        self._notification_service_process.start()
        self._webserver = Webserver()
        self._webserver_process = Process(
            target=self._webserver.start,
            args=(
                self._config_lock,
                self._notification_queue_webserver_in,
                self._notification_queue_webserver_out,
                self._effects_queue
            ))
        self._webserver_process.start()
        self._audio = AudioProcessService()
        self._audio_process = Process(
            target=self._audio.start,
            args=(
                self._config_lock,
                self._notification_queue_audio_in,
                self._notification_queue_audio_out,
                self._audio_queue
            ))
        self._audio_process.start()
        self.logger.info("Initialization finished.")
        try:
            self.logger.info("MLSC started...")
            self._cancel_token = False
            while not self._cancel_token:
                sleep(10)
        except KeyboardInterrupt:
            self.logger.info("Stopping MLSC...")
            self._notification_service_process.terminate()
            self._webserver_process.terminate()
            self.logger.info("MLSC stopped")
def start ( self ) : self . _config_lock = Lock ( ) self . _config_instance = ConfigService . instance ( self . _config_lock ) self . _config = self . _config_instance . config self . logger = logging . getLogger ( __name__ ) self . logger . info ( "Initializing MLSC..." ) self . _config_instance . check_compatibility ( ) self . _output_queue = Queue ( 2 ) self . _effects_queue = Queue ( 100 ) self . _audio_queue = Queue ( 2 ) self . _notification_queue_audio_in = Queue ( 100 ) self . _notification_queue_audio_out = Queue ( 100 ) self . _notification_queue_device_manager_in = Queue ( 100 ) self . _notification_queue_device_manager_out = Queue ( 100 ) self . _notification_queue_webserver_in = Queue ( 100 ) self . _notification_queue_webserver_out = Queue ( 100 ) self . _device_manager = DeviceManager ( ) self . _device_manager_process = Process ( target = self . _device_manager . start , args = ( self . _config_lock , self . _notification_queue_device_manager_in , self . _notification_queue_device_manager_out , self . _effects_queue , self . _audio_queue , ) ) self . _device_manager_process . start ( ) self . _notification_service = NotificationService ( ) self . _notification_service_process = Process ( target = self . _notification_service . start , args = ( self . _config_lock , self . _notification_queue_device_manager_in , self . _notification_queue_device_manager_out , self . _notification_queue_audio_in , self . _notification_queue_audio_out , self . _notification_queue_webserver_in , self . _notification_queue_webserver_out , ) ) self . _notification_service_process . start ( ) self . _webserver = Webserver ( ) self . _webserver_process = Process ( target = self . _webserver . start , args = ( self . _config_lock , self . _notification_queue_webserver_in , self . _notification_queue_webserver_out , self . _effects_queue ) ) self . _webserver_process . start ( ) self . _audio = AudioProcessService ( ) self . _audio_process = Process ( target = self . _audio . start , args = ( self . _config_lock , self . _notification_queue_audio_in , self . _notification_queue_audio_out , self . _audio_queue ) ) self . _audio_process . start ( ) self . logger . info ( "Initialization finished." ) try : self . logger . info ( "MLSC started..." ) self . _cancel_token = False while not self . _cancel_token : sleep ( 10 ) except KeyboardInterrupt : self . logger . info ( "Stopping MLSC..." ) self . _notification_service_process . terminate ( ) self . _webserver_process . terminate ( ) self . logger . info ( "MLSC stopped" )
This function will start all necessary components.
This function will start all necessary components .
"""
        This function will start all necessary components.
        Let's go :-D
        """ # We need a lock to prevent too fast saving and loading actions of the config # Create the instance of the config # Check config compatibility # Prepare the queue for the output # Prepare all notification queues # Start the DeviceManager Service # Start Notification Service # Start Webserver # Start audio process # Do nothing with this thread. Just wait for the exit.
self