if __name__ == "__main__": #socket import socket import time cvimage = np.zeros((480 * 640 * 3), dtype=np.uint8) pltimage = np.zeros((480, 640, 3), dtype=np.uint8) HOST = '192.168.3.100' PORT = 8881 time.sleep(2) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((HOST, PORT)) print('connect') device: WiFiDevice = asyncio.get_event_loop().run_until_complete( test_get_device_by_name()) if device: asyncio.get_event_loop().run_until_complete(test_connect(device)) asyncio.get_event_loop().run_until_complete(test_start_run_program()) # -- Detector, tracker, classifier skeleton_detector = SkeletonDetector(OPENPOSE_MODEL, OPENPOSE_IMG_SIZE) multiperson_tracker = Tracker() multiperson_classifier = MultiPersonClassifier(SRC_MODEL_PATH, CLASSES) # -- Image reader and displayer images_loader = select_images_loader(SRC_DATA_TYPE, SRC_DATA_PATH) img_displayer = lib_images_io.ImageDisplayer() # -- Init output
def start_process(self): video_cache_dir = self.check_video_cache_dir() if not video_cache_dir: return # 检查端口 port = self.local_frame.port() if not utils.is_int(port): return messagebox.showerror('错误', '端口只能是数字') port = int(port) if port < 2000 or port > 60000: return messagebox.showerror('错误', '端口只能从2000到60000') create_danmaku: bool = self.local_frame.create_danmaku() # print(video_cache_dir, port) # 检查 三个网址 video_url = self.video_frame.video_url() danmaku_url = self.video_frame.danmaku_url() proxy_url = self.video_frame.proxy_url() if create_danmaku: print('自建弹幕') danmaku_url = '1' # print(video_url, danmaku_url, proxy_url) if len(video_url) == 0: return messagebox.showerror('错误', '请填写视频源网址') else: if video_url != '1' and not utils.is_url(video_url): return messagebox.showerror( '错误', '视频源的格式错误,只接受:\nhttp:\\\\xxx\n的格式') if danmaku_url != '1': if len(danmaku_url) > 0 and not utils.is_url(danmaku_url): return messagebox.showerror( '错误', '弹幕源的格式错误,只接受:\nhttp:\\\\xxx\n的格式') if len(proxy_url) > 0: if not utils.is_url(proxy_url): return messagebox.showerror('错误', '代理的格式错误,只接受:\nhttp:\\\\xxx\n的格式') check = test_connect(video_url, proxy_url) if check != 'ok': has_proxy = len(proxy_url) > 0 title = '连接错误' if has_proxy: title = '代理服务器出现错误' message = title if check == 'NeedTWIP': message = '四季TV网络视频源 需要台湾IP' elif check == 'ProxyError': message = '连接不到代理服务器' elif check == 'NotM3u8': message = '网络视频源 返回的不是M3u8文件格式' elif check == 'TimeOut': message = '连接 网络视频源 超时(5秒)' return messagebox.showerror(title, message) self.__m3u8_process = Process(target=m3u8.run, args=(video_cache_dir, video_url, proxy_url, self.my_cache.cache)) self.__m3u8_process.start() only_video = self.local_frame.only_video() self.__server_process = Process(target=server.run, args=(port, video_cache_dir, danmaku_url, only_video, self.my_cache.cache)) self.__server_process.start() return '123ok'