Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters with query #31

Closed
ColorTwist opened this issue May 24, 2018 · 6 comments
Closed

Parameters with query #31

ColorTwist opened this issue May 24, 2018 · 6 comments

Comments

@ColorTwist
Copy link

Is there a sample of how to use parameters with query? and which parameters are available.

Another thing, related or not:
For example:
var art= await Artist.GetAsync(id);

This will return artist information which is great, but I noticed many fields are return empty like
Relations = null
Rating = null
Score = 0
etc..

I am looking for a way to receive also additional data like band members (relations, score) if i provide for example- backstreet boys mbid?

@wo80
Copy link
Collaborator

wo80 commented May 24, 2018

  1. There's only the base Relation class, so specialized relations like artist-rels or url-rels are not available at the moment.
  2. The Score value will only be set for search requests.
  3. If any other properties are null, this usually means that they were not available in the server response.
  4. If you want to include additional information in a Get request, use the inc parameter, for example
Artist.GetAsync(mbid, "release-groups", "tags", "works");
  1. If you want to setup the parameters for a Search request, you can use the QueryParameters class, see QueryParametersTests.cs.

@ColorTwist
Copy link
Author

I see, great!

Hope to see Relation implemented.
Where can i find Tag list supported?
I found https://picard.musicbrainz.org/docs/tags/
However, it seems i need a different tag list.

@wo80
Copy link
Collaborator

wo80 commented May 24, 2018

A tag is just a string, and most Musicbrainz entities will have a list of tags associated to them. Picard is a tool for tagging audio files (i.e. MP3 tags). Two different things ...

EDIT: I've created a PR #32 to add relationships. Are there any special relationships you would be intersted in to be added?

@ColorTwist
Copy link
Author

For me "members" and "original members" are important as it shows the member names of groups (bands).
Other information/images links resources for the singers/band. Like Wikipedia link, BBC music link, etc..
Not sure how important is that.

@wo80
Copy link
Collaborator

wo80 commented May 25, 2018

Ok, to get members and related websites you can now do

var mbid = "ca891d65-d9b0-4258-89f7-e6ba29d83767"; // Iron Maiden

var artist = await Artist.GetAsync(mbid, "artist-rels", "url-rels");
            
Console.WriteLine("{0} members:", artist.Name);

// To filter relations, inspect "TargetType" and "Type" properties of relation.
foreach (var relation in artist.Relations.Where(r => r.TargetType == "artist" && r.Type.Contains("member")))
{
    Console.WriteLine("{0}: {1} ({2} - {3})", relation.Artist.Name, string.Join(" / ", relation.Attributes),
        relation.Begin, relation.End);
}

Console.WriteLine("{0} related websites:", artist.Name);

foreach (var relation in artist.Relations.Where(r => r.TargetType == "url"))
{
    Console.WriteLine("{0}: {1}", relation.Type, relation.Url.Resource);
}

If you'd like to play around with the code - until the PR gets merged - you can checkout my fork https://github.com/wo80/MusicBrainz.

@ColorTwist
Copy link
Author

I checked, it's working!
Thanks, I really appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants