diff options
author | Dominic DiTaranto <domdit@gmail.com> | 2024-09-22 21:30:28 -0400 |
---|---|---|
committer | Dominic DiTaranto <domdit@gmail.com> | 2024-09-22 21:30:28 -0400 |
commit | 75e802e5b27425db95d000f714e3b3363a5e1a9c (patch) | |
tree | 1ed046b10702a9340934adeb6859f5322ef4920b /app.py |
Diffstat (limited to 'app.py')
-rw-r--r-- | app.py | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +import ast +from flask import Flask, render_template, request +from constants import chords +from generate_chord_tones import ChordToneGenerator + + +app = Flask(__name__) + + +@app.route('/', methods=('GET', 'POST')) +def index(): + chord_map = None + counts = None + if request.method == 'POST': + selected_chords = [] + for chord in request.form: + current_chord = request.form.get(chord) + if current_chord: + selected_chords.append(current_chord) + + if selected_chords: + generator = ChordToneGenerator(selected_chords) + generator.main() + chord_map = generator.prepped_chord_map + counts = generator.counts + + return render_template('index.html', chords=chords, chord_map=chord_map, counts=counts) |