Skip to content

fat84/MusicBrainz-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MuzicBrainz

Join the chat at https://gitter.im/avatar29A/MusicBrainz

Implementation MuzicBrainze API 2.0 (C#). Current version: 1.0.1

Build Status NuGet Issues

##Examples:

######Get Artist by Id.

 static void Main(string[] args)
 {
   var artist = Hqub.MusicBrainze.API.Entities.Artist.Get("c3cceeed-3332-4cf0-8c4c-bbde425147b6");

   Console.WriteLine(artist.Name);
 }

######Search artist by query.

 static void Main(string[] args)
 {
   var artists = Hqub.MusicBrainze.API.Entities.Artist.Search("scorpions");
   
   foreach(var artist in artists)
   {
      Console.WriteLine(artist.Name);
   }
   
   Console.ReadKey();
 }
Get Artist with Tags.
using Hqub.MusicBrainze.API.Entities;

static void Main(string[] args)
{
  var artist = Artist.Get("c3cceeed-3332-4cf0-8c4c-bbde425147b6", API.Entities.Include.ArtistIncludeEntityHelper.Tags);

  Console.WriteLine(artist.Name);
	
  foreach (var tag in artist.Tags)
  {
    Console.WriteLine("\t{0}", tag.Name);
  }

  Console.ReadKey();
}
Show Artist -> Album -> Tracks.
private static void Main(string[] args)
{
	try
	{
		var task = ShowAlbumTracks("The Rolling Stones", "Beggars Banquet");

		// The synchronous Wait() will wrap any exception in an AggregateException,
		// so be sure to catch it properly.
		task.Wait();
	}
	catch (AggregateException e)
	{
		Console.WriteLine(e.InnerException.Message);
	}

	Console.ReadKey();
}

private static async Task ShowAlbumTracks(string artistName, string albumName)
{
	var artist = (await Artist.SearchAsync(artistName)).First();

	Console.WriteLine(artist.Name);

	var query = string.Format("aid=({0}) release=({1})", artist.Id, albumName);
	var album = (await Release.SearchAsync(Uri.EscapeUriString(query), 10)).First();

	Console.WriteLine("\t{0}", album.Title);

	var release = await Release.GetAsync(album.Id, "recordings");

	int i = 1;

	foreach (var medium in release.MediumList)
	{
		foreach (var track in medium.Tracks)
		{
			var recording = track.Recordring;
			var length = TimeSpan.FromMilliseconds(recording.Length).ToString("m\\:ss");

			Console.WriteLine("\t\t{0,3:##} {1,6}  {2}", i++, length, recording.Title);
		}
	}
}

Also support next entities:

  • Release (Get, Search, Subqueries)
  • Recording (Get, Search, Subqueries)

More information about MuzicBrainz Service I here.

About

Impelmentation MuzicBrainze API 2.0 (C#)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%