Documentation
¶
Overview ¶
Package lyrics finds a song's words, and when they're sung: from a .lrc file next to the song, from the song's own tags, or (only when an admin turns it on) from LRCLIB, a free and open lyrics database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finder ¶
type Finder struct {
Prober probe.Prober
// Online looks songs up on LRCLIB; nil never does.
Online *LRCLIB
}
Finder finds songs' words.
type LRCLIB ¶
type LRCLIB struct {
// Base is the API; empty is https://lrclib.net/api.
Base string
Client *http.Client
UserAgent string
Dir string
}
LRCLIB looks up songs' words on LRCLIB (lrclib.net), a free, open database of lyrics that needs no account or key. The server asks it directly; nothing goes through anyone else. Answers, including "not there", are kept in Dir so each song is asked about once in a while.
type Line ¶
Line is one line of a song's words. Ms is when it's sung, in milliseconds from the start; it's nil when the words aren't timed.
type Lyrics ¶
type Lyrics struct {
Synced bool `json:"synced"`
Lines []Line `json:"lines"`
// Source says where they came from: file (a .lrc or .txt next to the
// song), embedded (the song's tags) or online (LRCLIB). Empty when
// there are none.
Source string `json:"source,omitempty"`
// Instrumental means the song has no words at all.
Instrumental bool `json:"instrumental,omitempty"`
}
Lyrics are a song's words. Synced means every line has its time.
func Embedded ¶
Embedded reads the words in a song's tags (keys lower-cased, as probe gives them): ID3's USLT shows up as lyrics-eng and the like, MP4's as lyrics, Vorbis comments as lyrics or unsyncedlyrics. Many taggers put timed LRC text in them; timed words win over untimed ones.