def startShow(self, id=None, **kwargs): if id is None: return if id in self.runningShows: return if not id in self.shows: return showParams = self.shows[id] args = showParams['definition'][:] Messenger.displayMessage('starting show %s' % str(id)) runner = ShowRunner() runner.startShow(*tuple(args), filter = self.shows[id]['filter']) self.runningShows[id] = runner self.emit({'show':id, 'running':True})
def __init__(self, modules): self.modules = modules self.keyMap = {} for mapping in LircListener._showMappings: for key in mapping['keys']: self.keyMap[key] = mapping super(LircListener, self).__init__() def onKey(self, key, remote): if key in self.keyMap: config = self.keyMap[key] args = [] if 'args' in config: args = config['args'][:] getattr(self.modules[config['module']], config['method'])(*tuple(args)) if __name__ == '__main__': Messenger.addOutput(ConsoleOutput()) Messenger.addOutput(LCDOutput()) Messenger.addOutput(Messaging()) receiver = UDPReceiver() receiver.start() remoteServer = RemoteServer() remoteServer.start() universe = Universe() output = Output.factory('LPD8806Output', 180) output.addFilter(AlphaFilter()) #output = Output.factory('WebsocketOutput') universe.setOutput(output)
def selectChannel(self, channel): self.currentChannel = self.getChannel(channel) Messenger.displayMessage('selected: %s' % channel);
def stopShow(self, id, **kwargs): if not id in self.runningShows: return Messenger.displayMessage('stopping show %s' % str(id)) self.runningShows[id].stopCurrentShow() del self.runningShows[id] self.emit({'show':id, 'running':False})