lrc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT-0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lyrics

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

Lyrics holds parsed lyrics.

func NewLyrics

func NewLyrics(times []time.Duration, lines []string) *Lyrics

NewLyrics return a new instance of Lyrics from an slice of times and of lines of a song. The user needs make sure that both are the same size.

func Parse

func Parse(data []byte) (*Lyrics, error)

Parse parses a byte slice of LRC lyrics.

func ParseString

func ParseString(text string) (*Lyrics, error)

ParseString parses a string of LRC lyrics.

func (*Lyrics) Lines

func (l *Lyrics) Lines() []string

Lines returns lines.

func (*Lyrics) N

func (l *Lyrics) N() int

N returns the number of lines held.

func (*Lyrics) Search

func (l *Lyrics) Search(d time.Duration) int

Search finds the index of lyrics lines where times is larger than d.

This can be used to find the lyrics line to be displayed at a perticular time.

i = lyrics.Search(1 * time.Minute) - 1

func (*Lyrics) Times

func (l *Lyrics) Times() []time.Duration

Times returns times.

type Parser

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

Perser is a parser type.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser return a new parser from a reader.

func (*Parser) Parse

func (p *Parser) Parse() (*Lyrics, error)

Parse parses the reader according to the LRC format. https://en.wikipedia.org/wiki/LRC_(file_format)

Jump to

Keyboard shortcuts

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