Added the integration to music brainz to get artist information. Next need to map that to a view model and surface a API for the UI to consume

pull/3895/head
Jamie Rees 5 years ago
parent da6e0858ae
commit af982114fb

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ombi.Api.MusicBrainz.Models.Artist;
using Ombi.Api.MusicBrainz.Models.Browse;
using Ombi.Api.MusicBrainz.Models.Search;
@ -9,5 +10,6 @@ namespace Ombi.Api.MusicBrainz
{
Task<IEnumerable<Artist>> SearchArtist(string artistQuery);
Task<IEnumerable<Release>> GetReleaseForArtist(string artistId);
Task<ArtistInformation> GetArtistInformation(string artistId);
}
}

@ -0,0 +1,58 @@
using Newtonsoft.Json;
namespace Ombi.Api.MusicBrainz.Models.Artist
{
public class ArtistInformation
{
public Begin_Area begin_area { get; set; }
[JsonProperty("gender-id")]
public object genderid { get; set; }
public string type { get; set; }
[JsonProperty("life-span")]
public LifeSpan lifespan { get; set; }
public string name { get; set; }
[JsonProperty("type-id")]
public string typeid { get; set; }
public object end_area { get; set; }
public object[] ipis { get; set; }
[JsonProperty("sort-name")]
public string sortname { get; set; }
public string[] isnis { get; set; }
public object gender { get; set; }
public string id { get; set; }
public Area area { get; set; }
public string disambiguation { get; set; }
public string country { get; set; }
}
public class Begin_Area
{
public string disambiguation { get; set; }
[JsonProperty("sort-name")]
public string sortname { get; set; }
public string id { get; set; }
public string name { get; set; }
}
public class LifeSpan
{
public bool ended { get; set; }
public object end { get; set; }
public string begin { get; set; }
}
public class Area
{
public string name { get; set; }
[JsonProperty("sort-name")]
public string sortname { get; set; }
public string disambiguation { get; set; }
public string id { get; set; }
[JsonProperty("iso-3166-1-codes")]
public string[] iso31661codes { get; set; }
}
}

@ -5,6 +5,7 @@ using System.Net.Http;
using System.Threading.Tasks;
using Ombi.Api.MusicBrainz.Models;
using Ombi.Api.MusicBrainz.Models.Artist;
using Ombi.Api.MusicBrainz.Models.Browse;
using Ombi.Api.MusicBrainz.Models.Search;
@ -30,6 +31,14 @@ namespace Ombi.Api.MusicBrainz
return albums.Data.Where(x => !x.type.Equals("Person", StringComparison.CurrentCultureIgnoreCase));
}
public async Task<ArtistInformation> GetArtistInformation(string artistId)
{
var request = new Request($"artist/{artistId}", _baseUrl, HttpMethod.Get);
AddHeaders(request);
return await _api.Request<ArtistInformation>(request);
}
public async Task<IEnumerable<Release>> GetReleaseForArtist(string artistId)
{
var request = new Request("release", _baseUrl, HttpMethod.Get);

Loading…
Cancel
Save