diff --git a/工具v2/工具面板.py b/工具v2/工具面板.py index 35f3cd8a..99b99e65 100644 --- a/工具v2/工具面板.py +++ b/工具v2/工具面板.py @@ -32,7 +32,7 @@ def SetButton(string,openfilelist): if not f in configjson: os.system("code -w "+f) else: - lineindex = getlineindex(f,"文本文件/config.json") + lineindex = getlineindex(f'"{f}"',"文本文件/config.json") os.system(f"code -w -g 文本文件/config.json:{lineindex}") diff --git a/工具v2/文本文件/config.json b/工具v2/文本文件/config.json index b7183056..0fa6de22 100644 --- a/工具v2/文本文件/config.json +++ b/工具v2/文本文件/config.json @@ -7,5 +7,10 @@ }, "pdf标题": "测试批量讲义", "提供答案": true + }, + "讲义生成.py": { + "讲义标题格式": "V202503\\d{2}", + "输出路径": "临时文件", + "提供答案": true } } \ No newline at end of file diff --git a/工具v2/讲义生成.py b/工具v2/讲义生成.py index 97de9f11..41cbba7a 100644 --- a/工具v2/讲义生成.py +++ b/工具v2/讲义生成.py @@ -1,13 +1,17 @@ -lessonpattern = r"U20240501" # 正则表达式, 数据库中讲义的编号([A-Z][0-9]{4}[(01)|(02)][[0-9]{2}), 字母表示类型, 四位数字表示届别, 2位数字表示学期及其他, 2位数字表示序号 -outputdir = "d:/temp/26届材料" # 输出文件夹, 不建议修改 -answered = True # 设置是否编译答案 - - -jsonpath = "../备课组" #有json文件的根目录, 文件名需为"校本材料.json" +# lessonpattern = r"U20240501" # 正则表达式, 数据库中讲义的编号([A-Z][0-9]{4}[(01)|(02)][[0-9]{2}), 字母表示类型, 四位数字表示届别, 2位数字表示学期及其他, 2位数字表示序号 +# outputdir = "d:/temp/26届材料" # 输出文件夹, 不建议修改 +# answered = True # 设置是否编译答案 from database_tools import * +configjson = load_dict("文本文件/config.json")["讲义生成.py"] +lessonpattern = configjson["讲义标题格式"] # 正则表达式, 数据库中讲义的编号([A-Z][0-9]{4}[(01)|(02)][[0-9]{2}), 字母表示类型, 四位数字表示届别, 2位数字表示学期及其他, 2位数字表示序号 +outputdir = configjson["输出路径"] # 输出文件夹, 不建议修改 +answered = configjson["提供答案"] # 设置是否编译答案 + + +jsonpath = "../备课组" #有json文件的根目录, 文件名需为"校本材料.json" jsondicts = [] for loc,dirs,files in os.walk(jsonpath): if "校本材料.json" in files: