本文整理汇总了Python中channel.Channel.addOutlet方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.addOutlet方法的具体用法?Python Channel.addOutlet怎么用?Python Channel.addOutlet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel.Channel
的用法示例。
在下文中一共展示了Channel.addOutlet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createChannelFromConfig
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import addOutlet [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)