subformat

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package subformat is used to manipulate different subtitle formats.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCouldNotDetermineFormat = errors.New("could not determine format to use")
	ErrFormatMismatch          = errors.New("format mismatch between the output file extension and the format given. use one or the other")
)

Functions

func AddExtensionToSubFile

func AddExtensionToSubFile(file string, fileFormat FormatType) string

func FileHasSubtitleExtension

func FileHasSubtitleExtension(fileName string) bool

Types

type FormatType

type FormatType int
const (
	FormatTypeSRT FormatType = iota + 1
	FormatTypeSTL
	FormatTypeTTML
	FormatTypeSSA
	FormatTypeVTT
	FormatTypeASS
)

func SubFormatFromFileName

func SubFormatFromFileName(fileName string) (FormatType, error)

func SubFormatFromFileNameOrFormatString

func SubFormatFromFileNameOrFormatString(fileName string, format string) (FormatType, error)

func SubFormatFromString

func SubFormatFromString(s string) (FormatType, error)

func (FormatType) String

func (t FormatType) String() string

type Formatter

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

func NewSubFormatter

func NewSubFormatter(subtitleType FormatType, r io.Reader) (Formatter, error)

func NewSubFormatterFromFile

func NewSubFormatterFromFile(fileName string) (Formatter, error)

func (*Formatter) ConvertToAndWrite

func (s *Formatter) ConvertToAndWrite(newFormatType FormatType, out io.Writer) error

func (*Formatter) Type

func (s *Formatter) Type() FormatType

func (*Formatter) Write

func (s *Formatter) Write(w io.Writer) error

Jump to

Keyboard shortcuts

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