srt

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: GPL-3.0, MIT Imports: 6 Imported by: 0

README

This is code from https://github.com/wargarblgarbl/libgosubs/tree/master

I've taken only part of the code for this to work and I have changed some small things, but the documentation of it should still be correct.

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSrt

func LoadSrt(v *SubRip, filepath string) error

LoadSrt loads the provided file into the given object. It fixes the \ufeff problem that some parsers have.

func WriteSrt

func WriteSrt(v *SubRip, outpath string) error

WriteSrt takes a SubRip object and the path to which to write the file as a string

func WriteSrtToWriter

func WriteSrtToWriter(v *SubRip, w io.Writer) error

WriteSrt takes a SubRip object and the path to which to write the file as a string

Types

type SubRip

type SubRip struct {
	Subtitle struct {
		Content []Subtitle
	}
}

SubRip is the overall file descriptor. It provides a container for us to dump subtitles into.

func ParseSrt

func ParseSrt(filename string) (*SubRip, error)

ParseSrt is the loader for srt files. Takes the path of the file being opened as the argument.

type Subtitle

type Subtitle struct {
	Id    int
	Start string
	End   string
	Line  []string
}

Subtitle struct provides all of the elements of an .srt subtitle with lines of subtitles being broken up into []strings

func CreateSubtitle

func CreateSubtitle(id int, start string, end string, text []string) *Subtitle

CreateSubtitle creates a subtitle object.

Jump to

Keyboard shortcuts

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