working note generator

This commit is contained in:
Tomasz Frątczak 2024-02-13 23:04:36 +01:00
parent f6bab3e7eb
commit 0d0750fa96
6 changed files with 31 additions and 11 deletions

0
notescriber/config.py Normal file
View File

View File

@ -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:

View File

@ -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)
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)

View File

@ -1,2 +1,3 @@
openai-whisper==20231117
pyinotify==0.9.6
pyinotify==0.9.6
nextcloud_notes_api==1.0.0

0
tests/__init__.py Normal file
View File

14
tests/notetaker_test.py Normal file
View File

@ -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)