generated by Claude-3.7-Sonnet

This commit is contained in:
2025-03-28 22:27:08 +08:00
commit fdde34e1f0
13 changed files with 1581 additions and 0 deletions

57
model/transcript.go Normal file
View File

@@ -0,0 +1,57 @@
// Package model 提供播客和剧集的数据模型
package model
import (
"time"
)
// TranscriptFormat 表示转录文件的格式
type TranscriptFormat string
const (
// TranscriptFormatJSON 表示JSON格式的转录
TranscriptFormatJSON TranscriptFormat = "json"
// TranscriptFormatSubrip 表示SRT格式的转录
TranscriptFormatSubrip TranscriptFormat = "subrip"
// TranscriptFormatUnsupported 表示不支持的格式
TranscriptFormatUnsupported TranscriptFormat = "unsupported"
)
// TranscriptURL 表示播客中包含的转录URL
type TranscriptURL struct {
// 转录的URL
URL string `json:"url,omitempty"`
// 转录的类型json或srt
Type TranscriptFormat `json:"type,omitempty"`
// 转录的语言
Language string `json:"language,omitempty"`
// 如果设置为captions表示这是一个闭合字幕文件
Rel string `json:"rel,omitempty"`
}
// Transcript 表示一个转录
type Transcript struct {
// 字幕列表
Subtitles []Subtitle `json:"subtitles,omitempty"`
}
// Subtitle 表示转录中的一行
type Subtitle struct {
// 字幕的索引(顺序)
Index int `json:"index,omitempty"`
// 字幕的开始时间
Start time.Duration `json:"start,omitempty"`
// 字幕的结束时间
End time.Duration `json:"end,omitempty"`
// 字幕的文本内容
Data string `json:"data,omitempty"`
// 发言人(可选)
Speaker string `json:"speaker,omitempty"`
}