mirror of https://github.com/dirtbags/moth.git
Associated files now included in puzzle.json
This commit is contained in:
parent
cf922f3217
commit
c85db04460
|
@ -97,9 +97,8 @@ if __name__ == '__main__':
|
||||||
# write out puzzles
|
# write out puzzles
|
||||||
for points in sorted(puzzles_dict):
|
for points in sorted(puzzles_dict):
|
||||||
puzzle = puzzles_dict[points]
|
puzzle = puzzles_dict[points]
|
||||||
puzzlebody = [json.dumps(puzzle.publish())]
|
|
||||||
puzzledir = os.path.join(categoryname, 'content', mapping[points])
|
puzzledir = os.path.join(categoryname, 'content', mapping[points])
|
||||||
# build/write json
|
puzzlejson = puzzle.publish()
|
||||||
|
|
||||||
# write associated files
|
# write associated files
|
||||||
assoc_files = []
|
assoc_files = []
|
||||||
|
@ -109,14 +108,8 @@ if __name__ == '__main__':
|
||||||
zf.writestr(os.path.join(puzzledir, fobj.name), \
|
zf.writestr(os.path.join(puzzledir, fobj.name), \
|
||||||
fobj.handle.read())
|
fobj.handle.read())
|
||||||
|
|
||||||
|
|
||||||
if len(assoc_files) > 0:
|
if len(assoc_files) > 0:
|
||||||
puzzlebody.append("")
|
puzzlejson["associated_files"] = assoc_files
|
||||||
puzzlebody.append("## Associated Files:")
|
|
||||||
for f in assoc_files:
|
|
||||||
puzzlebody.append(f)
|
|
||||||
|
|
||||||
puzzlebody = os.linesep.join(puzzlebody)
|
|
||||||
|
|
||||||
# non-optimal writing of file-like objects, but it works
|
# non-optimal writing of file-like objects, but it works
|
||||||
zf.writestr(os.path.join(puzzledir, 'puzzle.json'), \
|
zf.writestr(os.path.join(puzzledir, 'puzzle.json'), \
|
||||||
|
|
Loading…
Reference in New Issue