lrclibgo

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

README

lrclibgo

lrclibgo is a Go client to access the LyricFind API.

Go Report Card GoDoc

Contributing

IDK, it would be really nice of you to contribute, check the poorly written CONTRIBUTING.md for more info.

Roadmap

  • Search
  • Get song
  • Lyrics
  • Lyrics timing
  • Publish lyrics

Usage

package main

import (
	"encoding/json"
	"fmt"

	"github.com/mbaraa/lrclibgo"
)

func main() {
	client := lrclibgo.NewClient()
	results, err := client.Search.Get(lrclibgo.SearchParams{
		Query: "lana del rey jealous girl",
		Limit: 5,
	})
	if err != nil {
		panic(err)
	}

	for _, result := range results {
		jsonn, _ := json.MarshalIndent(result, "", "\t")
		fmt.Println("search result", string(jsonn))
	}
}

Support :)

Give a ⭐️ if this project helped you!


Made with 🧉 by Baraa Al-Masri

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Search *SearchService
	Songs  *SongsService
}

Client is the lrclibgo client that handles all the different API calls to lrclib.net/api

func NewClient

func NewClient() *Client

NewClient initializes the genius Client to interact with different lrclib.net/api calls.

type ErrApiError

type ErrApiError struct {
	StatusCode int
	Message    string
}

func (*ErrApiError) Error

func (e *ErrApiError) Error() string

type ErrInvalidParams

type ErrInvalidParams struct {
	ParamName string
}

func (*ErrInvalidParams) Error

func (e *ErrInvalidParams) Error() string

type ErrNotFound

type ErrNotFound struct{}

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

type GetSongParams

type GetSongParams struct {
	// TrackName is the title of the track.
	TrackName string
	// ArtistName is the name of the artist who performed the track.
	ArtistName string
	// AlbumName is the name of the album to which the track belongs.
	AlbumName string
	// Duration is the track's duration in seconds.
	Duration int `json:"duration"`
}

func (GetSongParams) UrlParams

func (p GetSongParams) UrlParams() url.Values

func (GetSongParams) Validate

func (p GetSongParams) Validate() error

type Lyrics

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

Lyrics holds the actual plain text value of the lyrics.

func (*Lyrics) Parts

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

func (*Lyrics) String

func (l *Lyrics) String() string

func (*Lyrics) Synced

func (l *Lyrics) Synced() map[string]string

type SearchParams

type SearchParams struct {
	// Query searches for keywords present in any of the track's title,
	// artist name, or album name fields.
	Query string
	// TrackName searches for keywords specifically within the track's title.
	TrackName string
	// ArtistName searches for keywords specifically within the track's artist name.
	ArtistName string
	// AlbumName searches for keywords specifically within the track's album name.
	AlbumName string
	// Limit limits the search results count.
	Limit int
}

SearchParams represents parameters for searching music tracks. It allows for general keyword search or specific searches within track title, artist name, or album name.

func (SearchParams) UrlParams

func (p SearchParams) UrlParams() url.Values

func (SearchParams) Validate

func (p SearchParams) Validate() error

type SearchService

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

func (*SearchService) Get

func (s *SearchService) Get(params SearchParams) ([]Song, error)

type Song

type Song struct {
	ID           int     `json:"id"`
	Name         string  `json:"name"`
	TrackName    string  `json:"trackName"`
	ArtistName   string  `json:"artistName"`
	AlbumName    string  `json:"albumName"`
	Duration     float32 `json:"duration"`
	Instrumental bool    `json:"instrumental"`
	PlainLyrics  string  `json:"plainLyrics"`
	SyncedLyrics string  `json:"syncedLyrics"`
	// contains filtered or unexported fields
}

Song represents how a song looks like coming from lrclib.net/api

func (*Song) Lyrics

func (s *Song) Lyrics() *Lyrics

type SongsService

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

func (*SongsService) Get

func (s *SongsService) Get(id string) (Song, error)

func (*SongsService) GetByParams

func (s *SongsService) GetByParams(params GetSongParams) (Song, error)

Jump to

Keyboard shortcuts

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