Example #1
0
    def setup(self):

        # Create channels
        for section in self.config.sections():
            if section.find('Channel_') == 0:
                name = self.config.get(section, 'name')
                input = self.config.get(section, 'input')
                output = self.config.get(section, 'output')
                channel = self.config.getint(section, 'channel')
                self.channels[name] = Channel(name, input, output, channel)
                
        # Create translators
        for section in self.config.sections():
            if section.find('Translator') == 0:
                values = section.split('_')
                name = values[0]
                options = {}
                for key, value in self.config.items(section):
                    options[key] = value
                translator = TranslatorFactory.create(self, name, options)
                if translator:
                    self.translators.append(translator)
                    
        # Open channels
        for channel in self.channels.values():
            channel.receive = self.__receive
            channel.open()