-
Notifications
You must be signed in to change notification settings - Fork 3
/
matcher.go
50 lines (39 loc) · 1.32 KB
/
matcher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package gomusixmatch
import (
"context"
mxmParams "github.com/milindmadhukar/go-musixmatch/params"
)
// Get the lyrics for track based on title and artist
//
// Parameters:
// QueryTrack - The song title
// QueryArtist - The song artist
func (client *Client) GetMatcherLyrics(ctx context.Context, params ...mxmParams.Param) (*Lyrics, error) {
var lyricsData lyrics
err := client.get(ctx, "matcher.lyrics.get", &lyricsData, params...)
if err != nil {
return nil, err
}
return &lyricsData.LyricsData, nil
}
// In some cases you already have some informations about the track title, artist name, album etc.
// A possible strategy to get the corresponding lyrics could be:
// search musixmatch's catalogue with a perfect match,
// maybe try using the fuzzy search,
// maybe try again using artist aliases, and so on.
//
// Parameters:
// QueryTrack - The song title
// QueryArtist - The song artist
// QueryAlbum - The song album
func (client *Client) GetMatcherTrack(ctx context.Context, params ...mxmParams.Param) (*Track, error) {
var trackData track
err := client.get(ctx, "matcher.track.get", &trackData, params...)
if err != nil {
return nil, err
}
return &trackData.TrackData, nil
}
// func (client *Client) GetMatcherSubtitle(ctx context.Context, params ...musixmatchParams.Param) () {
//
// }