feat: upload audio, get a private Swedish transcript, discuss it (#33, ADR-033) #39
@@ -18,8 +18,8 @@ type Limits struct {
|
||||
}
|
||||
|
||||
// Probe is what inspecting an uploaded file revealed. It is the input to Validate
|
||||
// because a name or MIME type cannot say whether a container carries video: a
|
||||
// Teams voice-only export is typically an .mp4 with no video stream.
|
||||
// because a name or MIME type cannot say what a container holds: a Teams recording
|
||||
// is an .mp4 whether or not the camera was on.
|
||||
type Probe struct {
|
||||
Duration time.Duration
|
||||
HasAudio bool
|
||||
@@ -30,7 +30,6 @@ type Probe struct {
|
||||
type Reason string
|
||||
|
||||
const (
|
||||
ReasonVideo Reason = "video"
|
||||
ReasonNoAudio Reason = "no_audio"
|
||||
ReasonTooLong Reason = "too_long"
|
||||
ReasonTooLarge Reason = "too_large"
|
||||
@@ -46,13 +45,13 @@ type RejectError struct {
|
||||
|
||||
func (e *RejectError) Error() string { return string(e.Reason) + ": " + e.Message }
|
||||
|
||||
// Validate decides whether a probed file may be transcribed. Video is checked
|
||||
// first so a video file is always refused as video, whatever its length.
|
||||
// Validate decides whether a probed file may be transcribed. A video track is NOT
|
||||
// a reason to refuse: a Teams meeting with the camera off is still an .mp4 with a
|
||||
// video track, so rejecting video would reject the primary use case. Only the audio
|
||||
// is used (Probe.HasVideo is recorded so the user can be told the video was
|
||||
// ignored). What IS refused: no audio at all, an unreadable length, too long.
|
||||
func Validate(p Probe, l Limits) error {
|
||||
switch {
|
||||
case p.HasVideo:
|
||||
return &RejectError{Reason: ReasonVideo, Message: "This file contains a video track. " +
|
||||
"Only audio recordings are supported for now; video upload is tracked in issue #28."}
|
||||
case !p.HasAudio:
|
||||
return &RejectError{Reason: ReasonNoAudio, Message: "This file has no audio track to transcribe."}
|
||||
case p.Duration <= 0:
|
||||
|
||||
Reference in New Issue
Block a user