diff --git a/notescriber.py b/notescriber.py index 8507352..3e1b92a 100755 --- a/notescriber.py +++ b/notescriber.py @@ -1,9 +1,11 @@ #!/usr/bin/env python from notescriber.transcriber import Transcriber +from notescriber.dispatcher import Dispatcher from notescriber.picker import Picker if __name__ == '__main__': transcriber = Transcriber() - picker = Picker("/home/octopusx/Code/test", transcriber) + dispatcher = Dispatcher(transcriber) + picker = Picker("/home/octopusx/Code/test", dispatcher) picker.observe() \ No newline at end of file diff --git a/notescriber/__init__.py b/notescriber/__init__.py index 75a5d00..7ff0332 100644 --- a/notescriber/__init__.py +++ b/notescriber/__init__.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from notescriber import dispatcher from notescriber import notetaker from notescriber import picker from notescriber import transcriber diff --git a/notescriber/dispatcher.py b/notescriber/dispatcher.py new file mode 100644 index 0000000..3b57348 --- /dev/null +++ b/notescriber/dispatcher.py @@ -0,0 +1,16 @@ +import threading + +class Dispatcher: + + threads = [] + callbackExecutor = None + + def __init__(self, callbackExecutor): + self.callbackExecutor = callbackExecutor + + def execute(self, audio_file): + thread = threading.Thread(target=self._execute_thread, args=(audio_file.pathname,)) + thread.start() + + def _execute_thread(self, audio_file): + self.callbackExecutor.execute(audio_file) \ No newline at end of file diff --git a/notescriber/transcriber.py b/notescriber/transcriber.py index 7da498e..fb071be 100644 --- a/notescriber/transcriber.py +++ b/notescriber/transcriber.py @@ -3,4 +3,4 @@ class Transcriber: pass def execute(self, audio_file): - print("Transcribing audio file: " + audio_file.pathname) \ No newline at end of file + print("Transcribing audio file: " + audio_file) \ No newline at end of file