removed dodgy code
@@ -9,18 +9,17 @@ from ..paths import CURRENT_MODEL_DIR
bp = Blueprint("model", __name__, url_prefix="/model")
bp.register_blueprint(comp.bp)
-Model model
+
@bp.route("/new")
def new():
#assuming that this would only be a POST?
- this.model = state.Model()
+ this.models = state.Model()
return '{"status": "new model created"}'
@bp.route("/name", methods=['GET', 'POST'])
def name():
file_path = os.path.join(CURRENT_MODEL_DIR, 'name.txt')
-
if request.method == 'POST':
# update the state name
with open(file_path, 'w') as fout:
@@ -32,13 +31,20 @@ def name():
@bp.route("/date")
def date():
- if request.method == "POST":
- newModel.
- return ''
+ file_path = os.path.join(CURRENT_MODEL_DIR, 'date.txt')
+ if request.method == 'POST':
+ # update the state name
+ with open(file_path, 'w') as fout:
+ fout.write(request.json['date'])
+
+ # return the state
+ with open(file_path, 'r') as fin:
+ return f'{{ "date": "{fin.read()}" }}'
@bp.route("/audio")
def audio():
- return ''
+ if request.method == "POST":
+ audio.append()
@bp.route("/transcription")
def transcription():
@@ -46,14 +52,38 @@ def transcription():
@bp.route("/additionalWords")
def additionalWord():
- return ''
+ file_path = os.path.join(CURRENT_MODEL_DIR, 'additionalWords.txt')
+ if request.method == 'POST':
+ # update the state name
+ with open(file_path, 'w') as fout:
+ fout.write(request.json['additionalWords'])
+
+ # return the state
+ with open(file_path, 'r') as fin:
+ return f'{{ "additionalWords": "{fin.read()}" }}'
@bp.route("/pronunciation")
def pronunciation():
- return ''
+ file_path = os.path.join(CURRENT_MODEL_DIR, 'pronunciation.txt')
+ if request.method == 'POST':
+ # update the state name
+ with open(file_path, 'w') as fout:
+ fout.write(request.json['pronunciation'])
+
+ # return the state
+ with open(file_path, 'r') as fin:
+ return f'{{ "pronunciation": "{fin.read()}" }}'
@bp.route("/settings")
def settings():
- return ''
+ file_path = os.path.join(CURRENT_MODEL_DIR, 'settings.txt')
+ if request.method == 'POST':
+ # update the state name
+ with open(file_path, 'w') as fout:
+ fout.write(request.json['settings'])
+
+ # return the state
+ with open(file_path, 'r') as fin:
+ return f'{{ "settings": "{fin.read()}" }}'
