mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Fixed: Album lookup API endpoint updated for new DB schema (#693)
This commit is contained in:
parent
6e4b1ba1fe
commit
dbb08c15d2
2 changed files with 10 additions and 7 deletions
|
@ -57,7 +57,7 @@ namespace Lidarr.Api.V1.Albums
|
||||||
{
|
{
|
||||||
if (model == null) return null;
|
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
|
return new AlbumResource
|
||||||
{
|
{
|
||||||
|
@ -75,12 +75,12 @@ namespace Lidarr.Api.V1.Albums
|
||||||
Images = model.Images,
|
Images = model.Images,
|
||||||
Links = model.Links,
|
Links = model.Links,
|
||||||
Ratings = model.Ratings,
|
Ratings = model.Ratings,
|
||||||
Duration = selectedRelease.Duration,
|
Duration = selectedRelease?.Duration ?? 0,
|
||||||
AlbumType = model.AlbumType,
|
AlbumType = model.AlbumType,
|
||||||
SecondaryTypes = model.SecondaryTypes.Select(s => s.Name).ToList(),
|
SecondaryTypes = model.SecondaryTypes.Select(s => s.Name).ToList(),
|
||||||
Releases = model.AlbumReleases.Value.ToResource(),
|
Releases = model.AlbumReleases?.Value.ToResource() ?? new List<AlbumReleaseResource>(),
|
||||||
Media = selectedRelease.Media.ToResource(),
|
Media = selectedRelease?.Media.ToResource() ?? new List<MediumResource>(),
|
||||||
Artist = model.Artist.Value.ToResource()
|
Artist = model.Artist?.Value.ToResource()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,10 +280,13 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
{
|
{
|
||||||
var album = _albumService.FindById(resource.Id) ?? MapAlbum(resource, null);
|
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;
|
return album;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue