提交 0dbe8ce2 创建 作者: 宋海霞's avatar 宋海霞

Replace convertodt.py

上级 89acf235
......@@ -6,9 +6,6 @@ import json
import os
# 参考:这是ci文件中的传入参数
# python3 convertpdf.py ${CODECODE_PROTOCOL}${CODECODE_DOMAIN}:3000 ci_job_token ${CI_JOB_TOKEN} ${CI_PROJECT_ID}
# 主机地址和端口号,用于访问api时构造url
host_with_port = sys.argv[1]
......@@ -48,21 +45,18 @@ filenames_arr = studentfilesinfo['filesinfo']
# 接口返回的文件是按创建时间降序排列,所以下面统计完最后一次提交的docx文档后会直接退出
for item in filenames_arr:
# 如果后缀名是docx的,则统计信息
filename, ext_name = os.path.splitext(item)
# 如果后缀名是docx的,则生成odt文件,统计信息
if ext_name == ".docx":
# 如果没找到文件,就继续下一条数据
if not (os.path.exists(item)):
os.system("没有找到文件:" + item)
continue
# 先将文件转换成odt
os.system("soffice --headless --convert-to odt " + "\"" + item + "\"")
# 整理odt文件名
file_odt = filename + ".odt"
# 统计报告信息
os.system("python3 storepy/statistics.py " + "\"" + file_odt + "\"" + " " + host_with_port + " " + projectid + " " + token_type_str + " " + token)
os.system("python3 storepy/statistics.py " + "\"" +item + "\"" + " " + host_with_port + " " + projectid + " " + token_type_str + " " + token)
# 退出
exit(0)
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论