subs

package
v1.2.3-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDefaultStyle

func IsDefaultStyle(item *astisub.Item) bool

IsDefaultStyle checks whether an item's style matches the "Default" prefix. Items without a style are treated as Default (common in SRT files).

func Subs2DubsFromView

func Subs2DubsFromView(dv *DialogueView, outputFile, FieldSep string) error

Subs2DubsFromView updates dialogue items through the view with STT transcriptions loaded from the TSV. This ensures mutations go through to the canonical structure.

Types

type DialogueView

type DialogueView struct {
	// contains filtered or unexported fields
}

DialogueView provides indexed access to dialogue-only items within a full subtitle structure. Items accessed through the view are pointers into the canonical Subtitles, so mutations (e.g. STT text updates) propagate automatically without any sync step.

func (*DialogueView) Item

func (dv *DialogueView) Item(i int) *astisub.Item

Item returns a pointer to the canonical subtitle item at the given dialogue index. Mutations go through to the underlying Subtitles.

func (*DialogueView) Len

func (dv *DialogueView) Len() int

Len returns the number of dialogue items in the view.

func (*DialogueView) RawIndex

func (dv *DialogueView) RawIndex(i int) int

RawIndex returns the index in the full subtitle structure for a dialogue index.

func (*DialogueView) Subs

func (dv *DialogueView) Subs() *Subtitles

Subs returns the underlying canonical Subtitles structure.

type Subtitles

type Subtitles struct {
	*astisub.Subtitles
}

func DeepCopy

func DeepCopy(in *Subtitles) *Subtitles

DeepCopy creates a deep copy of the Subtitles structure. Uses jinzhu/copier for reliable deep copying that automatically handles new fields added to astisub types.

func OpenFile

func OpenFile(filename string, clean bool) (*Subtitles, error)

func (*Subtitles) FilterToDefaultStyle

func (subs *Subtitles) FilterToDefaultStyle()

FilterToDefaultStyle removes all items that don't have a style matching "Default" prefix. Deprecated: prefer NewDialogueView() which provides a non-destructive view. Kept for use in bulk item counting where a temporary copy is used.

func (*Subtitles) NewDialogueView

func (s *Subtitles) NewDialogueView() *DialogueView

NewDialogueView builds a view containing only Default-style items.

func (*Subtitles) Subs2Dubs

func (subs *Subtitles) Subs2Dubs(outputFile, FieldSep string) (err error)

func (*Subtitles) Translate

func (subs *Subtitles) Translate(item *astisub.Item) *astisub.Item

Translate generates a new subtitle from all subtitles which overlap with the given item. FIXME

func (*Subtitles) TrimCC2Dubs

func (subs *Subtitles) TrimCC2Dubs()

func (*Subtitles) Write

func (subs *Subtitles) Write(filename string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址