diff --git a/notescriber/config.py b/notescriber/config.py new file mode 100644 index 0000000..e69de29 diff --git a/notescriber/dispatcher.py b/notescriber/dispatcher.py index 2c80a3d..15934b8 100644 --- a/notescriber/dispatcher.py +++ b/notescriber/dispatcher.py @@ -17,16 +17,13 @@ class Dispatcher: self.noteGenerator = noteGenerator def process_audio_file(self, audio_file): - self.threads.append(threading.Thread(target=self._execute_thread, args=(audio_file.pathname,))) + self.threads.append(threading.Thread(target=self._execute_thread, args=(audio_file,))) self.threads[-1].start() # TODO: we need to have a way to wipe old threads, otherwise we will have a memory leak - def generate_note(self, note): - pass - def _execute_thread(self, audio_file): - note = self.audioProcessor.execute(audio_file) - self.noteGenerator.generate_note(note) + note = self.audioProcessor.execute(audio_file.pathname) + self.noteGenerator.generate_note(audio_file.pathname, note) def halt(self): for thread in self.threads: diff --git a/notescriber/notetaker.py b/notescriber/notetaker.py index bbd8930..f01fec2 100644 --- a/notescriber/notetaker.py +++ b/notescriber/notetaker.py @@ -1,7 +1,15 @@ +from nextcloud_notes_api import NotesApi, Note + class Notetaker: - def __init__(self): - pass + username = None + password = None - def generate_note(self, note): - print("Received note: " + note) \ No newline at end of file + def __init__(self, username, password): + self.username = username + self.password = password + + def generate_note(self, filename, note): + api = NotesApi(self.username, self.password, 'cloud.octopusx.de') + ncnote = Note(title=filename, content=note, category="Voicenotes") + api.create_note(ncnote) diff --git a/requirements.txt b/requirements.txt index f7a8e7f..3a448ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ openai-whisper==20231117 -pyinotify==0.9.6 \ No newline at end of file +pyinotify==0.9.6 +nextcloud_notes_api==1.0.0 \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/notetaker_test.py b/tests/notetaker_test.py new file mode 100644 index 0000000..c1f8249 --- /dev/null +++ b/tests/notetaker_test.py @@ -0,0 +1,14 @@ +import unittest +from notescriber.notetaker import Notetaker + +class TranscriptorTest(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_run(self): + ntk = Notetaker() + ntk.generate_note("Test Note Title","This is my note") + self.assertEqual(True, True)