feat: persist voice samples to disk, generate VTT, cleanup after analysis
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
package testutil
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/paramah/gw_telegram/internal/domain/port"
|
||||
)
|
||||
|
||||
type FakeSpeechTranscriber struct {
|
||||
Transcript string
|
||||
Error error
|
||||
CallCount int
|
||||
Result port.TranscriptionResult
|
||||
Error error
|
||||
CallCount int
|
||||
}
|
||||
|
||||
func (f *FakeSpeechTranscriber) Transcribe(_ context.Context, _ []byte, _ string) (string, error) {
|
||||
func (f *FakeSpeechTranscriber) Transcribe(_ context.Context, _ []byte, _ string) (port.TranscriptionResult, error) {
|
||||
f.CallCount++
|
||||
return f.Transcript, f.Error
|
||||
return f.Result, f.Error
|
||||
}
|
||||
|
||||
33
test/testutil/fake_voice_file_store.go
Normal file
33
test/testutil/fake_voice_file_store.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package testutil
|
||||
|
||||
import "context"
|
||||
|
||||
type FakeVoiceFileStore struct {
|
||||
SaveRawPath string
|
||||
SaveConvertedPath string
|
||||
SaveVTTPath string
|
||||
SaveRawError error
|
||||
SaveConvertedError error
|
||||
SaveVTTError error
|
||||
CleanupError error
|
||||
CleanupCallCount int
|
||||
LastCleanupID string
|
||||
}
|
||||
|
||||
func (f *FakeVoiceFileStore) SaveRaw(_ context.Context, _ string, _ []byte) (string, error) {
|
||||
return f.SaveRawPath, f.SaveRawError
|
||||
}
|
||||
|
||||
func (f *FakeVoiceFileStore) SaveConverted(_ context.Context, _ string, _ []byte) (string, error) {
|
||||
return f.SaveConvertedPath, f.SaveConvertedError
|
||||
}
|
||||
|
||||
func (f *FakeVoiceFileStore) SaveVTT(_ context.Context, _ string, _ string) (string, error) {
|
||||
return f.SaveVTTPath, f.SaveVTTError
|
||||
}
|
||||
|
||||
func (f *FakeVoiceFileStore) Cleanup(_ context.Context, sampleID string) error {
|
||||
f.CleanupCallCount++
|
||||
f.LastCleanupID = sampleID
|
||||
return f.CleanupError
|
||||
}
|
||||
Reference in New Issue
Block a user