Associated files now included in puzzle.json

This commit is contained in:
slackish 2016-10-20 12:48:48 -06:00
parent c388d271a2
commit 2b29ffcf3d
1 changed files with 2 additions and 9 deletions

View File

@ -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'), \