mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
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
This commit is contained in:
parent
da6e0858ae
commit
af982114fb
3 changed files with 69 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
58
src/Ombi.Api.MusicBrainz/Models/Artist/ArtistInformation.cs
Normal file
58
src/Ombi.Api.MusicBrainz/Models/Artist/ArtistInformation.cs
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue