lyricsify

package module
v0.0.0-...-88a287f Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 15 Imported by: 0

README

Lyricsify

A tool to load the liked songs in Spotify, scrape the lyrics and add the ability to search through all of them.

Use case

You're a Spotify user, you have a lot of songs in your playlist, you remembered multiple words or a sentence in one of the songs in your playlist, you tried to google it and you weren't able to find the song. This tool should solve your problem because it will load all of your lyrics and allow you to search in all of it in an easy and reliable way.

https://github.com/ahmagdy/lyricsify/assets/10447926/9e635f0e-2dad-41ab-a36f-9cdd92c4374c

How to use it

Consider checking example folder.

Config

Expected values to be set as Environment Variables or in a YAML file in the Documents folder.

LYRICS_INDEX_NAME:
SPOTIFY_ID:
SPOTIFY_SECRET: 
GENIUS_TOKEN: 
GENIUS_BASE_URL: 
MUSIXMATCH_TOKEN:
LYRICS_PROVIDER: genius|musixmatch
Sample
ctx := context.Background()
// Initialize Instance of Lyricsify
svc, err := lyricsify.New(ctx, authServer.SpotifyClient())

// Load all of your songs in Liked Songs section, the key is the song name and the value is the artist/s
songsMap, err := lyricsify.LoadSongs(ctx)
// ......
// To get song lyrics as a text
lyrics, err := lyricsify.FetchLyrics(ctx, song, artists)

// Save Lyrics in the datastore
err := lyricsify.SaveLyrics(ctx, song, lyrics)

Docker Compose

Elasticsearch is required to run the tool, docker compose is ready to be used.

make d-up
make d-down
Tools used

License:

The MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthServer

func NewAuthServer(logger *zap.Logger, cfg *config.Config) *authServer

Types

type Service

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

Service Main package service

func New

func New(ctx context.Context, spotifyClient *spotify.Client) (*Service, error)

func (*Service) Fetch

func (s *Service) Fetch(ctx context.Context, songName string, artists string) (string, error)

Fetch To fetch song lyrics from the scraper

func (*Service) HasLyrics

func (s *Service) HasLyrics(ctx context.Context, title string) (bool, error)

func (*Service) LoadSongs

func (s *Service) LoadSongs(ctx context.Context) (map[string]string, error)

LoadSongs To load all songs from "LikedSongs" section in spotify

func (*Service) Save

func (s *Service) Save(ctx context.Context, title string, lyrics string) error

Save to save lyrics in a datastore in this case elasticsearch

func (*Service) Search

func (s *Service) Search(ctx context.Context, text string) ([]search.LyricsBody, error)

Search to search in the saved songs by text

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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