Documentation ¶
Overview ¶
Package sources contains the extractors for gLyrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // AnimeLyricsOrigin is the lyrics origin for Animelyrics AnimeLyricsOrigin = lyrics.Origin{Name: "Animelyrics", Website: "animelyrics.com"} // AnimeLyricsExtractor is an extractor for Animelyrics AnimeLyricsExtractor = ExtractorFunc(extractAnimeLyricsLyrics) )
var ( // AZLyricsOrigin is the lyrics origin for AZLyrics. AZLyricsOrigin = lyrics.Origin{Name: "AZLyrics", Website: "azlyrics.com"} // AZLyricsExtractor is an extractor for AZLyrics AZLyricsExtractor = ExtractorFunc(extractAZLyricsLyrics) )
var ( // GeniusOrigin is the Origin for Genius. GeniusOrigin = lyrics.Origin{Name: "Genius", Website: "genius.com"} // GeniusExtractor is an extractor for Genius GeniusExtractor = ExtractorFunc(extractGeniusLyrics) )
var ( // LyricalNonsenseOrigin is the lyrics origin for Lyrical Nonsense. LyricalNonsenseOrigin = lyrics.Origin{Name: "Lyrical Nonsense", Website: "lyrical-nonsense.com"} // LyricalNonsenseExtractor is an extractor for Lyrical Nonsense LyricalNonsenseExtractor = ExtractorFunc(extractLyricalNonsenseLyrics) )
var ( // LyricsModeOrigin is the glyrics.Origin for LyricsMode. LyricsModeOrigin = lyrics.Origin{Name: "LyricsMode", Website: "lyricsmode.com"} // LyricsModeExtractor is an extractor for LyricsMode LyricsModeExtractor = ExtractorFunc(extractLyricsModeLyrics) )
var ( // MusixMatchOrigin is the lyrics origin for MusixMatch. MusixMatchOrigin = lyrics.Origin{Name: "MusixMatch", Website: "musixmatch.com"} // MusixMatchExtractor is an extractor for MusixMatch MusixMatchExtractor = ExtractorFunc(extractMusixMatchLyrics) )
Functions ¶
func RegisterExtractor ¶
func RegisterExtractor(e MaybeExtractor)
RegisterExtractor adds a new Extractor to the registered sources. Registered extractors are returned by GetExtractorsForRequest.
Types ¶
type CanExtractTeller ¶
type CanExtractTeller interface { // CanExtract performs simple checks to determine whether the extractor // has any chance of extracting lyrics from the Request. CanExtract(req *request.Request) bool }
CanExtractTeller can tell whether lyrics can be extracted from the given request.
func RegexExtractorTeller ¶
func RegexExtractorTeller(re *regexp.Regexp) CanExtractTeller
RegexExtractorTeller wraps the regular expression in a struct that implements CanExtractTeller.
type Extractor ¶
type Extractor interface { // ExtractLyrics performs the actual extraction. ExtractLyrics(req *request.Request) (*lyrics.Info, error) }
Extractor extracts lyrics from a Request.
func GetExtractorsForRequest ¶
GetExtractorsForRequest returns a slice of all extractor which can extract lyrics from the given request.
type ExtractorFunc ¶
ExtractorFunc is a function which implements the Extractor interface.
func (ExtractorFunc) ExtractLyrics ¶
ExtractLyrics implements Extractor for extractor functions. It acts as an alias for the function itself.
type MaybeExtractor ¶
type MaybeExtractor interface { CanExtractTeller Extractor }
MaybeExtractor combines Extractor with CanExtractTeller.
func CreateMaybeExtractor ¶
func CreateMaybeExtractor(teller CanExtractTeller, extractor Extractor) MaybeExtractor
CreateMaybeExtractor combines a CanExtractTeller and an Extractor to a MaybeExtractor.