mirror of https://github.com/dirtbags/moth.git
puzzle directories are writing
This commit is contained in:
parent
d52ecab5ce
commit
6470cbd9d6
|
@ -10,7 +10,6 @@ import json
|
|||
import os
|
||||
import markdown
|
||||
import random
|
||||
import uuid
|
||||
import zipfile
|
||||
|
||||
messageChars = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
|
@ -124,22 +123,30 @@ for puzzledir in args.puzzledir:
|
|||
summary = {}
|
||||
for points in sorted(puzzles):
|
||||
puzzle = puzzles[points]
|
||||
print(args.seed)
|
||||
print(categoryname)
|
||||
print(points)
|
||||
|
||||
mapping[points] = str(uuid.uuid4()) # random uuid
|
||||
hashmap = hashlib.sha1(args.seed.encode('utf-8'))
|
||||
hashmap.update(categoryname.encode('utf-8'))
|
||||
hashmap.update(str(points).encode('utf-8'))
|
||||
mapping[points] = hashmap.hexdigest()
|
||||
answers[points] = puzzle.answers
|
||||
summary[points] = puzzle.fields['summary']
|
||||
|
||||
# write mapping, answers, and summary
|
||||
write_kv_pairs(zf, os.path.join(categoryname, 'mapping.txt'), mapping)
|
||||
write_kv_pairs(zf, os.path.join(categoryname, 'map.txt'), mapping)
|
||||
write_kv_pairs(zf, os.path.join(categoryname, 'answers.txt'), answers)
|
||||
write_kv_pairs(zf, os.path.join(categoryname, 'summary.txt'), summary)
|
||||
print(mapping)
|
||||
print(answers)
|
||||
print(summary)
|
||||
|
||||
# write out puzzles
|
||||
for points in sorted(puzzles):
|
||||
puzzle = puzzles[points]
|
||||
puzzledir = os.path.join(categoryname, "content", mapping[points])
|
||||
# test write
|
||||
write_kv_pairs(zf, os.path.join(puzzledir, 'summary.txt'), summary)
|
||||
# build json
|
||||
|
||||
|
||||
|
||||
#vim:py
|
||||
|
|
Loading…
Reference in New Issue