当前位置: 首页>>代码示例>>Python>>正文


Python Channel.slug方法代码示例

本文整理汇总了Python中channel.Channel.slug方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.slug方法的具体用法?Python Channel.slug怎么用?Python Channel.slug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在channel.Channel的用法示例。


在下文中一共展示了Channel.slug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createChannelFromConfig

# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import slug [as 别名]
    def createChannelFromConfig(self,configObject):
        channel = Channel(configObject['name'],self.config)
        channel.slug = configObject['slug']            
        channel.url = configObject['url']

        
        # ================
        # = Inlet/Source =
        # ================

        if configObject['source']['type'] == 'kniveTCPSource':
            channel.inlet = TCPTSServer(
                                                secret=configObject['source']['sharedSecret'],
                                                port=configObject['source']['listenPort']
                                            )
        elif configObject['source']['type'] == 'GstInlet':
            channel.inlet = GstInlet(
                name = configObject['source']['name'],
                pipeline = configObject['source']['pipeline']
            )
        else:
            print "Unknown Inlet Type %s" % self.config['source']['type']
            sys.exit(1)

        # ===============
        # = Set outlets =
        # ===============
        for outletsectionname in configObject['outlets']:
            logging.debug('Setting up outlet: %s' % outletsectionname)
            outletConfig = configObject['outlets'][outletsectionname]
            if outletConfig['type'] == 'HTTPLive': 
                try:
                    httplivestream = HTTPLiveStream(channel=channel,destdir=outletConfig['outputLocation'],publishURL=outletConfig['publishURL'])
                    channel.addOutlet(httplivestream)
                except Exception, err:
                    logging.exception(err)
                    sys.exit(1)

                for qualityname in outletConfig.sections:
                    qualityConfig = outletConfig[qualityname]
                    httplivestream.createQuality(qualityname,qualityConfig,ffmpegbin=self.config['paths']['ffmpegbin'])
                
                

            elif outletConfig['type'] == 'StreamArchiver':
                
                archiver = FileWriter(
                        self.config[outletsectionname]['outputdir'],
                        suffix=self.config[outletsectionname]['suffix'],
                        keepFiles=self.config[outletsectionname]['keepfiles'],
                        filename=self.config[outletsectionname]['filename']
                )
                channel.addOutlet(archiver)
开发者ID:cato-,项目名称:knive,代码行数:55,代码来源:knive.py


注:本文中的channel.Channel.slug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。