diff --git a/py/iptv流畅度检测.py b/py/iptv流畅度检测.py index 1ccf28c..d37c96b 100644 --- a/py/iptv流畅度检测.py +++ b/py/iptv流畅度检测.py @@ -672,7 +672,7 @@ from tqdm import tqdm detected_ips = {} # 存储文件路径 file_path = "酒店源.txt" -output_file_path = "JD.txt" +output_file_path = "酒店优选.txt" def get_ip_key(url): """从URL中提取IP地址,并构造一个唯一的键""" # 找到'//'到第三个'.'之间的字符串 @@ -738,7 +738,7 @@ for ip_key, result in detected_ips.items(): ####################### 提示用户输入文件名(拖入文件操作)打开用户指定的文件对不规范频道名再次替换 -file_path = 'JD.txt' +file_path = '酒店优选.txt' # 检查文件是否存在 if not os.path.isfile(file_path): print("文件不存在,请重新输入.") @@ -845,7 +845,7 @@ replacements = { } -with open('JD.txt', 'w', encoding='utf-8') as new_file: +with open('酒店优选.txt', 'w', encoding='utf-8') as new_file: for line in lines: # 去除行尾的换行符 line = line.rstrip('\n') @@ -886,10 +886,10 @@ replacements = { "": "" } # 打开原始文件读取内容,并写入新文件 -with open('JD.txt', 'r', encoding='utf-8') as file: +with open('酒店优选.txt', 'r', encoding='utf-8') as file: lines = file.readlines() # 创建新文件并写入替换后的内容 -with open('JD.txt', 'w', encoding='utf-8') as new_file: +with open('酒店优选.txt', 'w', encoding='utf-8') as new_file: for line in lines: for old, new in replacements.items(): line = line.replace(old, new) @@ -899,7 +899,7 @@ print("替换完成,新文件已保存。") ###############################################################################文本排序 # 打开原始文件读取内容,并写入新文件 -with open('JD.txt', 'r', encoding='utf-8') as file: +with open('酒店优选.txt', 'r', encoding='utf-8') as file: lines = file.readlines() # 定义一个函数,用于提取每行的第一个数字 def extract_first_number(line): @@ -985,7 +985,7 @@ for line in lines: unique_lines.append(line) seen_lines.add(line) # 将唯一的行写入新的文档 -with open('JD.txt', 'w', encoding="utf-8") as file: +with open('酒店优选.txt', 'w', encoding="utf-8") as file: file.writelines(unique_lines) #任务结束,删除不必要的过程文件 files_to_remove = ['去重.txt', "2.txt", "iptv.txt", "e.txt", "a0.txt", "a.txt", "a1.txt", "b.txt", "c.txt", "c1.txt", "c2.txt", "d.txt", "f.txt", "o1.txt", "o.txt", "酒店源#.txt"] @@ -1576,8 +1576,8 @@ with open(output_file_path, 'w', encoding='utf-8') as output_file: cap = cv2.VideoCapture(url) start_time = time.time() frame_count = 0 - # 尝试捕获5秒内的帧 - while frame_count < 220 and (time.time() - start_time) < 10: + # 尝试捕获10秒内的帧 + while frame_count < 230 and (time.time() - start_time) < 10: ret, frame = cap.read() if not ret: break @@ -1585,7 +1585,7 @@ with open(output_file_path, 'w', encoding='utf-8') as output_file: # 释放资源 cap.release() # 根据捕获的帧数判断状态并记录结果 - if frame_count >= 220: #5秒内超过100帧则写入 + if frame_count >= 230: #10秒内超过230帧则写入 detected_ips[ip_key] = {'status': 'ok'} output_file.write(line) # 写入检测通过的行 else: @@ -1719,7 +1719,7 @@ for line in lines: unique_lines.append(line) seen_lines.add(line) # 将唯一的行写入新的文档 -with open('ZB.txt', 'w', encoding="utf-8") as file: +with open('组播优选.txt', 'w', encoding="utf-8") as file: file.writelines(unique_lines) ################################################################################################任务结束,删除不必要的过程文件