mirror of https://github.com/lidarr/Lidarr
Fixed: Album lookup API endpoint updated for new DB schema (#693)
This commit is contained in:
parent
6e4b1ba1fe
commit
dbb08c15d2
|
@ -57,7 +57,7 @@ namespace Lidarr.Api.V1.Albums
|
|||
{
|
||||
if (model == null) return null;
|
||||
|
||||
var selectedRelease = model.AlbumReleases.Value.Where(x => x.Monitored).SingleOrDefault();
|
||||
var selectedRelease = model.AlbumReleases?.Value.Where(x => x.Monitored).SingleOrDefault();
|
||||
|
||||
return new AlbumResource
|
||||
{
|
||||
|
@ -75,12 +75,12 @@ namespace Lidarr.Api.V1.Albums
|
|||
Images = model.Images,
|
||||
Links = model.Links,
|
||||
Ratings = model.Ratings,
|
||||
Duration = selectedRelease.Duration,
|
||||
Duration = selectedRelease?.Duration ?? 0,
|
||||
AlbumType = model.AlbumType,
|
||||
SecondaryTypes = model.SecondaryTypes.Select(s => s.Name).ToList(),
|
||||
Releases = model.AlbumReleases.Value.ToResource(),
|
||||
Media = selectedRelease.Media.ToResource(),
|
||||
Artist = model.Artist.Value.ToResource()
|
||||
Releases = model.AlbumReleases?.Value.ToResource() ?? new List<AlbumReleaseResource>(),
|
||||
Media = selectedRelease?.Media.ToResource() ?? new List<MediumResource>(),
|
||||
Artist = model.Artist?.Value.ToResource()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -280,10 +280,13 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||
{
|
||||
var album = _albumService.FindById(resource.Id) ?? MapAlbum(resource, null);
|
||||
|
||||
if (album.Artist == null)
|
||||
var artist = _artistService.FindById(resource.ArtistId);
|
||||
if (artist == null)
|
||||
{
|
||||
album.Artist = _artistService.GetArtist(album.ArtistId);
|
||||
artist = new Artist();
|
||||
artist.Metadata = MapArtistMetadata(resource.Artists.Single(x => x.Id == resource.ArtistId));
|
||||
}
|
||||
album.Artist = artist;
|
||||
|
||||
return album;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue