-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
36 lines (29 loc) · 1.2 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from transcriber import Transcriber
from database import Database
class AudioFile:
def __init__(self, id, file_name, file_path):
self.id = id
self.file_name = file_name
self.file_path = file_path
class AudioLibrary:
def __init__(self):
self.database = Database()
self.database.create_tables()
def add_audio_file(self, audio_file):
print(audio_file.file_name, audio_file.file_path)
self.database.insert_audio_file(audio_file)
def update_audio_file(self, audio_file):
self.database.update_audio_file(audio_file)
def get_audio_file(self, id):
return self.database.get_audio_file(id)
def get_all_audio_files(self):
return self.database.get_all_audio_files()
class TranscriptionView:
def __init__(self, audio_library):
self.audio_library = audio_library
self.transcriber = Transcriber()
def transcribe_audio_file(self, audio_file):
self.transcriber.transcribe_audio(audio_file)
self.audio_library.database.update_audio_file(audio_file)
def get_transcription_status(self, audio_file):
return self.audio_library.database.get_audio_file(audio_file.id).transcription_status