def parse_log(self, logdir):
logpath = self.find_log(logdir)
if not logpath:
return {}
fh = open(logpath, "rt", encoding='cp437')
try:
stage_pattern = re.compile(r'^\S+\s+\S+\s+Texture stage #(\d+)\s.*\\([^\\]+)\\(Tex_\d+_\d+\.dds)\s*$')
mesh_pattern = re.compile(r'^\S+\s+\S+\s+Mesh saved as:.*\\([^\\]+)\\(Mesh_\d+\.rip)\s*$')
logtable = {}
stage_accum = {}
for line in fh:
match = mesh_pattern.fullmatch(line)
if match:
subdir = match.group(1).lower()
if subdir not in logtable:
logtable[subdir] = {}
logtable[subdir][match.group(2).lower()] = stage_accum
stage_accum = {}
else:
match = stage_pattern.fullmatch(line)
if match:
stage_accum[int(match.group(1))] = match.group(3)
return logtable
finally:
fh.close()
import-ninja.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录