コード例 #1
0
ファイル: service.py プロジェクト: ragzilla/txwatbf3
class WATBF3Service(MultiService):
	mongo  = None
	config = None
	ic     = None
	rc     = None
	tw     = None
	st     = None
	
	def __init__(self, config):
		MultiService.__init__(self)
		self.config = config

	@defer.inlineCallbacks
	def startService(self):
		self.mongo = yield txmongo.MongoConnectionPool()
		if self.config['web']['enable']:
			ww = watweb.Application(self, self.config['web'])
			ws = TCPServer(self.config['web']['port'], ww, interface=self.config['web']['bind']).setServiceParent(self)
		if self.config['irc']['enable']:
			self.ic = watirc.getwatircClient(self, self.config['irc'])
			self.ic.setServiceParent(self)
		if self.config['rcon']['enable']:
			self.rc = RconManager(self, self.config['rcon'])
			self.rc.setServiceParent(self)
		if self.config['twitter']['enable']:
			twcfg = self.config['twitter']
			self.tw = Twython(twcfg['app_key'], twcfg['app_secret'], twcfg['oauth_token'], twcfg['oauth_secret'])
		if self.config['stats']['enable']:
			self.st = StatsProvider(self, self.config['stats'])
		MultiService.startService(self)
	
	def getRcon(self):
		return self.rc
	
	def getIrc(self):
		return self.ic
	
	def getRootService(self):
		return self
	
	def getMongo(self):
		return self.mongo.watbf3
	
	def getTwitter(self):
		return self.tw
	
	def getStats(self):
		return self.st
コード例 #2
0
ファイル: service.py プロジェクト: ragzilla/txwatbf3
	def startService(self):
		self.mongo = yield txmongo.MongoConnectionPool()
		if self.config['web']['enable']:
			ww = watweb.Application(self, self.config['web'])
			ws = TCPServer(self.config['web']['port'], ww, interface=self.config['web']['bind']).setServiceParent(self)
		if self.config['irc']['enable']:
			self.ic = watirc.getwatircClient(self, self.config['irc'])
			self.ic.setServiceParent(self)
		if self.config['rcon']['enable']:
			self.rc = RconManager(self, self.config['rcon'])
			self.rc.setServiceParent(self)
		if self.config['twitter']['enable']:
			twcfg = self.config['twitter']
			self.tw = Twython(twcfg['app_key'], twcfg['app_secret'], twcfg['oauth_token'], twcfg['oauth_secret'])
		if self.config['stats']['enable']:
			self.st = StatsProvider(self, self.config['stats'])
		MultiService.startService(self)