lyricfind

package module
v0.0.0-...-037dbc6 Latest Latest
Warning

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

Go to latest
Published: May 14, 2015 License: MIT Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

lyricfind

Lyricfind client for the Go language

Usage

Import
import ("github.com/pilu/lyricfind")
Initializing a Lyricfind client
client := lyricfind.NewClient()
client.SearchApiKey   = "LYRICFIND_SEARCH_API_KEY"
client.DisplayApiKey  = "LYRICFIND_DISPLAY_API_KEY"
res, err := client.SearchByArtistAndTrack(artist, track)

if err != nil {
  fmt.Printf("Error: %v\n", err)
} else {
  for index, track := range  res.Tracks {
    fmt.Printf("Result %d:\n", index + 1)
    fmt.Printf("  Amg: %v\n", track.Amg)
    fmt.Printf("  Instrumental: %v\n", track.Instrumental)
    fmt.Printf("  Viewable: %v\n", track.Viewable)
    fmt.Printf("  Has lrc: %v\n", track.Has_lrc)
    fmt.Printf("  Title: %v\n", track.Title)
    fmt.Printf("  Artist: %v\n", track.Artist.Name)
    fmt.Printf("  Snippet: %v\n", track.Snippet)
    fmt.Printf("  Last update: %v\n", track.Last_update)
    fmt.Printf("  Score: %v\n", track.Score)
  }
}
Get lyrics
res, err := client.GetLyrics(id, userAgent)

if err != nil {
  fmt.Printf("Error: %v\n", err)
} else {
  track := res.Track
  fmt.Printf("Amg: %v\n", track.Amg)
  fmt.Printf("Instrumental: %v\n", track.Instrumental)
  fmt.Printf("Viewable: %v\n", track.Viewable)
  fmt.Printf("Has lrc: %v\n", track.Has_lrc)
  fmt.Printf("Title: %v\n", track.Title)
  fmt.Printf("Artist: %v\n", track.Artist.Name)
  fmt.Printf("Last update: %v\n", track.Last_update)
  fmt.Printf("Copyright: %v\n", track.Copyright)
  fmt.Printf("Writer: %v\n", track.Writer)
  fmt.Printf("Lyrics:\n%v\n", track.Lyrics)
}
Search and Get Lyrics
res, err := client.SearchAndGetLyrics(artist, track, userAgent)

if err != nil {
  fmt.Printf("Error: %v\n", err)
} else {
  track := res.Track
  fmt.Printf("Amg: %v\n", track.Amg)
  fmt.Printf("Instrumental: %v\n", track.Instrumental)
  fmt.Printf("Viewable: %v\n", track.Viewable)
  fmt.Printf("Has lrc: %v\n", track.Has_lrc)
  fmt.Printf("Title: %v\n", track.Title)
  fmt.Printf("Artist: %v\n", track.Artist.Name)
  fmt.Printf("Last update: %v\n", track.Last_update)
  fmt.Printf("Copyright: %v\n", track.Copyright)
  fmt.Printf("Writer: %v\n", track.Writer)
  fmt.Printf("Lyrics:\n%v\n", track.Lyrics)
}
Authors

Documentation

Index

Constants

View Source
const (
	TEST_BASE_URI = "http://test.lyricfind.com/api_service"
	LIVE_BASE_URI = "http://api.lyricfind.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Artist

type Artist struct {
	Name string `json:"name"`
}

type Client

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

func New

func New(env *Environment) *Client

func (*Client) Lyric

func (c *Client) Lyric(loc location, useragent string, amg int) (*LyricsResponse, error)

func (*Client) Search

func (c *Client) Search(loc location, options *SearchOptions) (*SearchResponse, error)

type Environment

type Environment struct {
	SearchApiKey  string
	DisplayApiKey string
	Live          bool
}

func (*Environment) Url

func (e *Environment) Url() *url.URL

type IPAddress

type IPAddress string

type LyricsResponse

type LyricsResponse struct {
	Response *Response `json:"response"`
	Track    *Track    `json:"track"`
}

type Response

type Response struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
	Message     string `json:"message"`
}

type SearchOptions

type SearchOptions struct {
	Artist          string
	Album           string
	Track           string
	Lyrics          string
	Meta            string
	All             string
	OnlyDisplayable bool
	Offset          int
	Limit           int
}

type SearchResponse

type SearchResponse struct {
	Response     *Response `json:"response"`
	TotalResults int       `json:"total_results"`
	TotalPages   int       `json:"total_pages"`
	Tracks       []*Track  `json:"tracks"`
}

type Territory

type Territory string

type Track

type Track struct {
	Amg          int     `json:"amg"`
	Instrumental bool    `json:"instrumental"`
	Viewable     bool    `json:"viewable"`
	HasLrc       bool    `json:"has_lrc"`
	Title        string  `json:"title"`
	Artist       *Artist `json:"artist"`
	Snippet      string  `json:"snippet"`
	LastUpdate   string  `json:"last_update"`
	Score        float64 `json:"score"`
	Lyrics       string  `json:"lyrics"`
	Copyright    string  `json:"copyright"`
	Writer       string  `json:"writer"`
}

Directories

Path Synopsis
cmd
lyricfind command

Jump to

Keyboard shortcuts

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