package model // Timestamp represents a time in a subtitle file type Timestamp struct { Hours int Minutes int Seconds int Milliseconds int } // Lyrics represents a lyrics file with metadata and content type Lyrics struct { Metadata map[string]string Timeline []Timestamp Content []string } // SRTEntry represents a single entry in an SRT file type SRTEntry struct { Number int StartTime Timestamp EndTime Timestamp Content string } // SubtitleEntry represents a generic subtitle entry in our intermediate representation type SubtitleEntry struct { Index int // Sequential index/number StartTime Timestamp // Start time EndTime Timestamp // End time Text string // The subtitle text content Styles map[string]string // Styling information (e.g., VTT's align, position) Classes []string // CSS classes (for VTT) Metadata map[string]string // Additional metadata FormatData map[string]interface{} // Format-specific data that doesn't fit elsewhere } // Subtitle represents our intermediate subtitle representation used for conversions type Subtitle struct { Title string // Optional title Metadata map[string]string // Global metadata (e.g., LRC's ti, ar, al) Entries []SubtitleEntry // Subtitle entries Format string // Source format Styles map[string]string // Global styles (e.g., VTT STYLE blocks) Comments []string // Comments/notes (for VTT) Regions []SubtitleRegion // Region definitions (for VTT) FormatData map[string]interface{} // Format-specific data that doesn't fit elsewhere } // SubtitleRegion represents a region definition (mainly for VTT) type SubtitleRegion struct { ID string Settings map[string]string } // Creates a new empty Subtitle func NewSubtitle() Subtitle { return Subtitle{ Metadata: make(map[string]string), Entries: []SubtitleEntry{}, Styles: make(map[string]string), Comments: []string{}, Regions: []SubtitleRegion{}, FormatData: make(map[string]interface{}), } } // Creates a new empty SubtitleEntry func NewSubtitleEntry() SubtitleEntry { return SubtitleEntry{ Styles: make(map[string]string), Classes: []string{}, Metadata: make(map[string]string), FormatData: make(map[string]interface{}), } } // Creates a new SubtitleRegion func NewSubtitleRegion(id string) SubtitleRegion { return SubtitleRegion{ ID: id, Settings: make(map[string]string), } }