New: Refactor metadata update

This commit is contained in:
ta264
2019-07-09 21:14:05 +01:00
parent f5c1858d4c
commit 0b7a42ee3b
19 changed files with 1352 additions and 729 deletions
@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
{
public class ArtistResource
{
public ArtistResource() {
public ArtistResource()
{
Albums = new List<AlbumResource>();
Genres = new List<string>();
}
public List<string> Genres { get; set; }
@@ -82,10 +82,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
artist.SortName = Parser.Parser.NormalizeTitle(artist.Metadata.Value.Name);
artist.Albums = FilterAlbums(httpResponse.Resource.Albums, metadataProfileId)
.Select(x => new Album {
ForeignAlbumId = x.Id
})
.ToList();
.Select(x => MapAlbum(x, null)).ToList();
return artist;
}
@@ -136,6 +133,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
var artists = httpResponse.Resource.Artists.Select(MapArtistMetadata).ToList();
var artistDict = artists.ToDictionary(x => x.ForeignArtistId, x => x);
var album = MapAlbum(httpResponse.Resource, artistDict);
album.ArtistMetadata = artistDict[httpResponse.Resource.ArtistId];
return new Tuple<string, Album, List<ArtistMetadata>>(httpResponse.Resource.ArtistId, album, artists);
}
@@ -181,8 +179,6 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
.SetSegment("route", "search")
.AddQueryParam("type", "artist")
.AddQueryParam("query", title.ToLower().Trim())
//.AddQueryParam("images","false") // Should pass these on import search to avoid looking to fanart and wiki
//.AddQueryParam("overview","false")
.Build();