GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - michiwend/gomusicbrainz: a Go (Golang) MusicBrainz WS2 client library - work in progress

BranchesTags
Open more actions menu

Latest commit

 

History

155 Commits
155 Commits

Folders and files

NameName
Last commit message
Last commit date
misc
misc
 
 
samples
samples
 
 
testdata
testdata
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
annotation.go
annotation.go
 
 
annotation_test.go
annotation_test.go
 
 
area.go
area.go
 
 
area_test.go
area_test.go
 
 
artist.go
artist.go
 
 
artist_test.go
artist_test.go
 
 
cd_stub.go
cd_stub.go
 
 
cd_stub_test.go
cd_stub_test.go
 
 
freedb.go
freedb.go
 
 
gomusicbrainz.go
gomusicbrainz.go
 
 
gomusicbrainz_test.go
gomusicbrainz_test.go
 
 
label.go
label.go
 
 
label_test.go
label_test.go
 
 
place.go
place.go
 
 
place_test.go
place_test.go
 
 
recording.go
recording.go
 
 
recording_test.go
recording_test.go
 
 
release.go
release.go
 
 
release_group.go
release_group.go
 
 
release_group_test.go
release_group_test.go
 
 
release_test.go
release_test.go
 
 
structs.go
structs.go
 
 
tag.go
tag.go
 
 
work.go
work.go
 
 

Repository files navigation

gomusicbrainz License MIT GoDoc GoWalker Build Status

a Go (Golang) MusicBrainz WS2 client library - a work in progress.

gopherbrainz Oo

Current state

Currently GoMusicBrainz provides methods to perform search and lookup requests. Browse requests are not supported yet.

Installation

$ go get github.com/michiwend/gomusicbrainz

Search Requests

GoMusicBrainz provides a search method for every WS2 search request in the form:

func (*WS2Client) Search<ENTITY>(searchTerm, limit, offset) (<ENTITY>SearchResponse, error)

searchTerm follows the Apache Lucene syntax and can either contain multiple fields with logical operators or just a simple search string. Please refer to lucene.apache.org for more details on the lucene syntax. In addition the [MusicBrainz website] (https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search) provides information about all possible query-fields.

Example

This example demonstrates a simple search requests to find the artist Parov Stelar. You can find it as a runnable go program in the samples folder.

// create a new WS2Client.
client := gomusicbrainz.NewWS2Client(
    "https://musicbrainz.org/ws/2",
    "A GoMusicBrainz example",
    "0.0.1-beta",
    "http://github.com/michiwend/gomusicbrainz")

// Search for some artist(s)
resp, _ := client.SearchArtist(`artist:"Parov Stelar"`, -1, -1)

// Pretty print Name and score of each returned artist.
for _, artist := range resp.Artists {
    fmt.Printf("Name: %-25sScore: %d\n", artist.Name, resp.Scores[artist])
}

the above code will produce the following output:

Name: Parov Stelar             Score: 100
Name: Parov Stelar Trio        Score: 80
Name: Parov Stelar & the Band  Score: 70

Lookup Requests

GoMusicBrainz provides two ways to perform lookup requests: Either the specific lookup method that is implemented for each entity that has a lookup endpoint in the form

func(*WS2Client) Lookup<ETITY>(id MBID, inc ...string) (*<ENTITY>, error)

or the common lookup method if you already have an entity (with MBID) that implements the MBLookupEntity interface:

func(*WS2Client) Lookup(entity MBLookupEntity, inc ...string) error

Example

The following example demonstrates the (specific) LookupArtist method. You can find it as a runnable go program in the samples folder.

// create a new WS2Client.
client, _ := gomusicbrainz.NewWS2Client(
    "https://musicbrainz.org/ws/2",
    "A GoMusicBrainz example",
    "0.0.1-beta",
    "http://github.com/michiwend/gomusicbrainz")

// Lookup artist by id.
artist, err := client.LookupArtist("9a709693-b4f8-4da9-8cc1-038c911a61be")

if err != nil {
    fmt.Println(err)
    return
}

fmt.Printf("%+v", artist)

Package Documentation

Full documentation for this package can be found at GoDoc and GoWalker

About

a Go (Golang) MusicBrainz WS2 client library - work in progress

Topics

clientclient-librarygogolangmusicbrainzmusicbrainz-api

Resources

Readme
MIT license
Activity

Stars

63 stars

Watchers

5 watching

Forks

27 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.