|
import os |
|
|
|
|
|
recordings = {} |
|
|
|
|
|
def teacher_question(): |
|
question = input("Enter your question: ") |
|
return question |
|
|
|
|
|
def record_student_voice(student_name, question, voice): |
|
|
|
file_path = f"recordings/{student_name}_{question}.wav" |
|
os.makedirs("recordings", exist_ok=True) |
|
with open(file_path, "wb") as f: |
|
f.write(voice) |
|
|
|
|
|
if question in recordings: |
|
recordings[question].append(file_path) |
|
else: |
|
recordings[question] = [file_path] |
|
|
|
return "Voice recorded successfully!" |
|
|
|
|
|
def play_recorded_voice(question): |
|
if question in recordings: |
|
print("Available recordings:") |
|
for index, file_path in enumerate(recordings[question], start=1): |
|
print(f"{index}. {file_path}") |
|
else: |
|
print("No recordings available for this question.") |
|
|
|
|
|
def write_comment(question, comment): |
|
|
|
return f"Comment '{comment}' added successfully for question '{question}'." |
|
|
|
|
|
|
|
question = teacher_question() |
|
|
|
|
|
student_name = input("Enter your name: ") |
|
record_student_voice(student_name, question, b"Dummy voice data") |
|
|
|
|
|
play_recorded_voice(question) |
|
|
|
|
|
comment = input("Write your comment: ") |
|
write_comment(question, comment) |
|
|