讲义生成.py的初始设定部分移到config.json

This commit is contained in:
weiye.wang 2024-02-04 22:44:58 +08:00
parent d904461d9b
commit 737ccad202
3 changed files with 16 additions and 7 deletions

View File

@ -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}")

View File

@ -7,5 +7,10 @@
},
"pdf标题": "测试批量讲义",
"提供答案": true
},
"讲义生成.py": {
"讲义标题格式": "V202503\\d{2}",
"输出路径": "临时文件",
"提供答案": true
}
}

View File

@ -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: