|
|
|
@ -13,9 +13,11 @@ class Questions(object):
|
|
|
|
|
QUESTION_TYPES = ["Text", "Image", "Music", "Code", "Video"]
|
|
|
|
|
QUESTION_KEYS = ["Name", "Question", "Answer", "Type", "Double-Jeopardy", "Audio"]
|
|
|
|
|
|
|
|
|
|
def __init__(self, qfile):
|
|
|
|
|
def __init__(self, qfile, appendPath=False):
|
|
|
|
|
self.qfile = qfile
|
|
|
|
|
self._questions = None
|
|
|
|
|
self._appendPath = appendPath
|
|
|
|
|
self._basedir = os.path.dirname(qfile)
|
|
|
|
|
self._read_questions()
|
|
|
|
|
|
|
|
|
|
def get_sections(self):
|
|
|
|
@ -90,6 +92,8 @@ class Questions(object):
|
|
|
|
|
|
|
|
|
|
# check if file for music/image questions exist
|
|
|
|
|
if q["Type"] in ("Music", "Image", "Video"):
|
|
|
|
|
if self._appendPath:
|
|
|
|
|
q["Question"] = os.path.join(self._basedir, q["Question"])
|
|
|
|
|
if not os.path.isfile(q["Question"]):
|
|
|
|
|
raise QuestionException("File for question %d, section %d (%s) not found" % (j, i, sec["Section"]))
|
|
|
|
|
|
|
|
|
|