return PMS_list[PMS_uuid]['serverName'].decode( 'utf-8', 'replace') # return as utf-8 else: return '[PMS_uuid not found]' if __name__ == "__main__": cfg = Settings.CSettings() param = {} param['CSettings'] = cfg param['Addr_PMS'] = '*Addr_PMS*' param['HostToIntercept'] = 'trailers.apple.com' setParams(param) cfg = ATVSettings.CATVSettings() setATVSettings(cfg) print "load PMS XML" _XML = '<PMS number="1" string="Hello"> \ <DATA number="42" string="World"></DATA> \ <DATA string="Sun"></DATA> \ </PMS>' PMSroot = etree.fromstring(_XML) PMSTree = etree.ElementTree(PMSroot) XML_prettyprint(PMSTree) print print "load aTV XML template" _XML = '<aTV> \
break # do your work (with timeout) server.handle_request() except KeyboardInterrupt: signal.signal(signal.SIGINT, signal.SIG_IGN) # we heard you! dprint(__name__, 0, "^C received.") finally: dprint(__name__, 0, "Shutting down (HTTPS).") server.socket.close() if __name__ == "__main__": cmdPipe = Pipe() cfg = Settings.CSettings(CONFIG_PATH) param = {} param['CSettings'] = cfg param['CATVSettings'] = ATVSettings.CATVSettings(CONFIG_PATH) param['IP_self'] = os.getenv("IP_SELF", "192.168.1.18") param['baseURL'] = 'http://' + param['IP_self'] + ':' + cfg.getSetting( 'port_webserver') param['HostToIntercept'] = cfg.getSetting('hosttointercept') if len(sys.argv) == 1: Run(cmdPipe[1], param) elif len(sys.argv) == 2 and sys.argv[1] == 'SSL': Run_SSL(cmdPipe[1], param)
break # do your work (with timeout) server.handle_request() except KeyboardInterrupt: signal.signal(signal.SIGINT, signal.SIG_IGN) # we heard you! dprint(__name__, 0, "^C received.") finally: dprint(__name__, 0, "Shutting down (HTTPS).") server.socket.close() if __name__ == "__main__": cmdPipe = Pipe() cfg = Settings.CSettings() param = {} param['CSettings'] = cfg param['CATVSettings'] = ATVSettings.CATVSettings() param['IP_self'] = '192.168.178.20' # IP_self? param['baseURL'] = 'http://' + param['IP_self'] + ':' + cfg.getSetting( 'port_webserver') param['HostToIntercept'] = cfg.getSetting('hosttointercept') if len(sys.argv) == 1: Run(cmdPipe[1], param) elif len(sys.argv) == 2 and sys.argv[1] == 'SSL': Run_SSL(cmdPipe[1], param)