webvtt

package
v0.0.0-...-f890984 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadWebVtt

func LoadWebVtt(v *WebVtt, filepath string) error

LoadWebVtt loads a WebVtt file

func WriteWebVtt

func WriteWebVtt(v *WebVtt, outpath string) error

WriteWebVtt takes a WebVtt object and the path to which to write the file as a string

Types

type Position

type Position struct {
	Vertical    string
	Line        int
	Posstring   string
	Position    int
	Linepercent bool
	Align       string
	Size        int
}

Position is a struct that stores the positional data on a per-line level

func CreatePosition

func CreatePosition(vertical string, line int, posstring string, pos int, lpercent bool, align string, size int) *Position

CreatePosition creates a VTT subtiotle position

type Style

type Style struct {
	Header string
	Value  map[string]interface{}
}

Style struct contains the style header information and a map of the contained values

func CreateStyle

func CreateStyle(header string, variables map[string]interface{}) *Style

CreateStyle creates a style from a header string and an interface containing the variables

type Subtitle

type Subtitle struct {
	Note     bool
	Cue      string
	Start    string
	End      string
	Haspos   bool
	Position Position
	Line     []string
}

Subtitle is the struct that stores subtitles and notes for WebVtt. The Note bool determines whether the Subtitle is actually a note or not.

func CreateSubtitle

func CreateSubtitle(note bool, cue string, start string, end string, text []string, pos Position, haspos bool) *Subtitle

CreateSubtitle creates a VTT formatted subtitle

type WebVtt

type WebVtt struct {
	Header   string
	Styles   []Style
	Subtitle struct {
		Content []Subtitle
	}
}

WebVtt is the container struct for a WebVtt subtitle

func ParseWebVtt

func ParseWebVtt(filename string) (*WebVtt, error)

ParseWebVtt takes a filename and returns a WebVtt structure and any errors

Jump to

Keyboard shortcuts

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