def parse(): parser = argparse.ArgumentParser( description="Route audio of a video file through a local server.") group = parser.add_mutually_exclusive_group() parser.add_argument( "-f", "--file", required=True, dest="f", help="Path to video files or directory containing video files", type=str, action="append", ) parser.add_argument("--qr", help="Show qr code with the link", dest="qr", action="store_true") parser.add_argument( "--control", help="only host can control play/pause signals", dest="onlyHost", action="store_true", ) parser.add_argument( "--force-rebuild", help="Force rebuild of the local server", dest="rebuild", action="store_true", ) parser.add_argument( "--audio-quality", dest="q", help="Audio quality to sync from", choices=["low", "medium", "good", "high"], type=str, default="medium", ) group.add_argument( "--web", help="Force routing through a web server", dest="web", action="store_true", ) args = parser.parse_args() args.localIP = getLocalIP() videos = [] for i in range(len(args.f)): args.f[i] = os.path.abspath(args.f[i]) videos.extend(get_videos(args.f[i], TO_CLEAR)) args.f = videos return args
def test_getLocalIP(): print('[py/getLocalIP]') print(util.getLocalIP()) oIniConfig = util.IniConfig() oFilePathFn = lambda name: os.path.join(sys.path[0], f'{name}.ini') sInputPath = oFilePathFn('config') oIniConfig.read(sInputPath) oIniConfig.set('net', 'ip', '220.181.38.148') sOutputPath = oFilePathFn('output') with open(sOutputPath, 'w') as oFile: oIniConfig.write(oFile)
def __init__(self, localIP=None, buffersize=2**12, multicastIP='239.255.42.99', multicastPort=1511): ''' Constructor ''' self.__multicastIP = multicastIP if localIP: self.__localIP = localIP else: self.__localIP = getLocalIP() # print self.__localIP self.__port = multicastPort self.__buffer = bytearray(buffersize) self.buffersize = buffersize # TODO: define tracked objects and origin self.trackedObjects = [1] self.origin = RigidBody() self.setup()
def __init__(self, server=getLocalIP(), port=PORT, own_thread=True): Thread.__init__(self) self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print 'Server. ip: '+str(server)+' port: '+str(port) self.__s.bind((server, port)) self.__s.setblocking(0) self.__s.listen(5) self.__readers, self.__writers = ([], []) self.__in={} self.__serialisables={} self.__stopped=False self.__outQs={} self.__outs={} self.__nextInst=1 self.bytes_read=0 self.bytes_sent=0 self.__dead=False self.daemon=True self._ctors={} self.start()
def __init__(self, factory, ident=None, server=getLocalIP(), port=PORT): print 'Client.__init__. ident: '+str(ident) self.__server=server self.__port=port self.factory=factory Mirrorable.__init__(self, self.TYP, ident, self)
serverName = "stunserver.org" serverIP = None serverPort = 3478 secondName = None#stun服务器的第二个地址,用于再次发送test1型消息 secondPort = None externalIP1 = None#本机在外网的IP和port externalPort1 = None externalIP2 = None#本机在外网的IP和port externalPort2 = None natType = constants.Uncomplete localIP = util.getLocalIP() logFileName = "stun.txt" logger = util.logger(logFileName) stunAtrChangeRequest = None messageID = [util.GenTranID(), util.GenTranID(), util.GenTranID(), util.GenTranID()] class responseMessage: #msgType, msgLength, attributeDict #attributeDict = {attributeType1:value1,......} def __init__(self): self.msgType = None
if(first): server.create_room() player.play() player.pause() player.seek(0) server.add_track(video) if __name__ == "__main__": signal.signal(signal.SIGINT, exitHandler) args = parse() args.localIP = getLocalIP() set_vars(args) if not args.web: spawn_server() player.launch() BaseManager.register("ServerConnection", ServerConnection) manager = BaseManager() manager.start() server = manager.ServerConnection() server.start_listening() Process(target=player.update, args=(server,)).start()
"test.testcases.Performance.ChannelPerformance#goIntoChanelTest", "test.testcases.Performance.ChannelPerformance#swipePortraitChannelTest", "test.testcases.Performance.ChannelPerformance#rotateScreenTest", "test.testcases.Performance.ChannelPerformance#switchPageTest", "test.testcases.Performance.ChannelPerformance#sendMsgTest", "test.testcases.Performance.ChannelPerformance#longTimeInChanelTest", "test.testcases.Performance.HomePagePerformance#swipeDownRefreshTest", "test.testcases.Performance.HomePagePerformance#swipeUpTest", "test.testcases.Performance.HomePagePerformance#homePageTabTest", "test.testcases.Performance.HomePagePerformance#horizontalSwipeTest", "test.testcases.Performance.IMPerformance#sendMsgTest", "test.testcases.Performance.IMPerformance#sendPhotoTest", "test.testcases.Performance.IMPerformance#sendEmotionTest", "test.testcases.Performance.IMPerformance#sendRandomContentTest", "test.testcases.Performance.StartLivePerformance#startLiveTest", "test.testcases.Performance.StartLivePerformance#switchCameraTest", "test.testcases.Performance.StartLivePerformance#landScapeSwitchCameraTest", "test.testcases.Performance.StartLivePerformance#switchResolutionTest", "test.testcases.Performance.StartLivePerformance#switchPageTest", # "test.testcases.BVT.StartLiveTest#phoneLiveTest", # "test.testcases.BVT.StartLiveTest#focusTexBoxTest" ] logcatCommand = "adb -s %s shell logcat -v time |grep TestRunner" espressoLogName = "espresso_%s.log" logcatLogName = "logcat_%s.log" performanceDataFile = "performanceData_%s" clearLogcatCammand = "adb -s %s shell logcat -c" shareRootPath = "http://%s:%d/" % (util.getLocalIP("eth0"), 80)