Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.19 KB

README.md

File metadata and controls

58 lines (40 loc) · 1.19 KB

About

GoDoc

This is a go library and command-line tools for handling .srt, .vtt and .ssa subtitles

Installation

Windows and macOS binaries are available under Releases

Or install them directly from git:

go install github.com/martinlindhe/subtitles/cmd/subber@latest

Sub-projects

  • subber command line tool for subtitles

Library example - convert srt to vtt

import "github.com/martinlindhe/subtitles"

in := "1\n" +
    "00:00:04,630 --> 00:00:06,018\n" +
    "Go ninja!\n" +
    "\n" +
    "1\n" +
    "00:01:09,630 --> 00:01:11,005\n" +
    "No ninja!\n"
res, _ := subtitles.NewFromSRT(in)

// Output: WEBVTT
//
// 00:04.630 --> 00:06.018
// Go ninja!
//
// 01:09.630 --> 01:11.005
// No ninja!
fmt.Println(res.AsVTT())

Library example - download subtitles

f, _ := os.Open(fileName)
defer f.Close()

finder := subtitles.NewSubFinder(f, fileName, "en")
text, err := finder.TheSubDb()

License

Under MIT