def _add_wake_word_file(self, account: Account, file_name: str): """Add the sample to the database for reference and classification. :param account: the account from which sample originated :param file_name: name of the audio file saved to file system """ sample = WakeWordFile( account_id=account.id, location=self.file_location, name=file_name, origin="mycroft", submission_date=datetime.utcnow().date(), wake_word=self.wake_word, ) file_repository = WakeWordFileRepository(self.db) file_repository.add(sample)
def add_wake_word_file(context, file_name): """Add a row to the tagging.file table for testing.""" location_repository = TaggingFileLocationRepository(context.db) file_location = location_repository.ensure_location_exists( server="127.0.0.1", directory="some/dummy/file/directory") wake_word_file = WakeWordFile( wake_word=context.wake_words["hey selene"], name=file_name, origin="mycroft", submission_date=datetime.utcnow().date(), location=file_location, status=UPLOADED_STATUS, account_id=context.account.id, ) file_repository = WakeWordFileRepository(context.db) file_repository.add(wake_word_file)
def add_wake_word_sample(context): """Add a sample wake word file to the database to be queried by future steps.""" file_repository = WakeWordFileRepository(context.db) location_repository = TaggingFileLocationRepository(context.db) location = TaggingFileLocation(server="127.0.0.1", directory="/opt/selene/data") location.id = location_repository.add(location) wake_word_file = WakeWordFile( wake_word=context.wake_word, name="test.wav", origin="mycroft", submission_date=datetime.utcnow().date(), account_id=context.accounts["foo"].id, status="uploaded", location=location, ) file_repository.add(wake_word_file) file_repository.change_file_status(wake_word_file, PENDING_DELETE_STATUS) context.wake_word_file = wake_word_file