def add()

in awstreamer/gst_pipeline/stream_client.py [0:0]


    def add(self, config_or_filename=None):
        '''
        Build pipeline and add to the registry
        '''
        # Get config in the proper format
        config = self.get_config(config_or_filename)

        # Add default id if config is flat
        if config is not None and "pipeline" in config:
            key = "default_%d" % len(self.pipelines.keys())
            config = { key: config }

        for key in config:
            # Skip those sources that are disabled in configuration
            if "enabled" in config[key] and not config[key]["enabled"]:
                logger.info("Skipping %s (disabled)" % key)
                continue

            # Parse config
            config[key]["id"] = key
            pipeline_config = StreamConfig(config[key])
            logger.info(pformat(pipeline_config))

            # Create pipeline
            pipeline = PipelineFactory.createPipeline(pipeline_config)
            self.pipelines[key] = pipeline

        if len(self.pipelines.keys()) == 1:
            return tuple(self.pipelines.values())[0]

        return tuple(self.pipelines.values())