feat: git init
This commit is contained in:
33
pkg/output/formatter.go
Normal file
33
pkg/output/formatter.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"transcribe/internal/whisper"
|
||||
)
|
||||
|
||||
// Formatter interface for converting transcription results to various output formats
|
||||
type Formatter interface {
|
||||
Format(result *whisper.TranscriptionResult) (string, error)
|
||||
}
|
||||
|
||||
// FormatType represents the output format type
|
||||
type FormatType string
|
||||
|
||||
const (
|
||||
FormatText FormatType = "text"
|
||||
FormatSRT FormatType = "srt"
|
||||
FormatJSON FormatType = "json"
|
||||
)
|
||||
|
||||
// NewFormatter creates a formatter for the given format type
|
||||
func NewFormatter(format FormatType) Formatter {
|
||||
switch format {
|
||||
case FormatSRT:
|
||||
return &SRTFormatter{}
|
||||
case FormatJSON:
|
||||
return &JSONFormatter{}
|
||||
case FormatText:
|
||||
fallthrough
|
||||
default:
|
||||
return &TextFormatter{}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user