From f53dd4e30cbcc35a0cb187eaf9db49d2c36d7cc2 Mon Sep 17 00:00:00 2001 From: yuanzhen869 Date: Sat, 9 Nov 2024 07:27:09 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/convert?= =?UTF-8?q?=5Fsurge=5Fto=5Fgogost.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/convert_surge_to_gogost.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/convert_surge_to_gogost.py b/.gitea/workflows/convert_surge_to_gogost.py index 914660f..0e9521f 100644 --- a/.gitea/workflows/convert_surge_to_gogost.py +++ b/.gitea/workflows/convert_surge_to_gogost.py @@ -1,5 +1,4 @@ import os -import re def convert_surge_to_gogost(input_path, output_path): with open(input_path, 'r') as infile, open(output_path, 'w') as outfile: @@ -56,7 +55,8 @@ os.makedirs(output_dir, exist_ok=True) # 逐个转换指定目录中的 Surge 规则文件 for filename in os.listdir(input_dir): - if filename.endswith(".list"): # 假设规则文件以 .txt 结尾 + if filename.endswith(".list"): # Surge 规则文件以 .list 结尾 input_path = os.path.join(input_dir, filename) - output_path = os.path.join(output_dir, filename) + output_filename = f"{os.path.splitext(filename)[0]}.txt" # 输出文件以 .txt 结尾 + output_path = os.path.join(output_dir, output_filename) convert_surge_to_gogost(input_path, output_path) \ No newline at end of file