lyrics

package
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package lyrics proxies the public LrcLib API (https://lrclib.net) from the backend, mirroring how tmdb/subtitles/imagesearch call external services server-side. Doing it here (not from the browser) lets us:

  • send a proper identifying User-Agent (LrcLib etiquette) WITHOUT tripping a CORS preflight the browser can't satisfy;
  • cache results so repeated views don't re-hit the public API;
  • shield each client's IP from LrcLib's per-IP rate limiting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a cached LrcLib proxy. The zero value is not usable — call New.

func New

func New() *Client

func (*Client) Get

func (c *Client) Get(ctx context.Context, artist, title, album string, durationSec int) (Lyrics, error)

Get resolves lyrics for a track. It tries the exact /api/get first, then falls back to /api/search. Results (including "not found") are cached for cacheTTL. A nil error with an empty Source means "no lyrics found".

type Lyrics

type Lyrics struct {
	Synced string `json:"synced"`
	Plain  string `json:"plain"`
	Source string `json:"source"` // "lrclib" | "" (none)
}

Lyrics is what the handler returns to the player. Synced is LRC with [mm:ss.xx] timestamps (preferred); Plain is the fallback unsynced text.

Jump to

Keyboard shortcuts

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