mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-23 22:25:09 -04:00
Fixed: Posters not always showing when searching for new authors
(cherry picked from commit 10dc884fa87a8337e9f0622c269adede0b262029) Co-authored-by: optimous012 Closes #145
This commit is contained in:
@@ -11,10 +11,12 @@ namespace Readarr.Api.V1.Author
|
||||
public class AuthorLookupController : Controller
|
||||
{
|
||||
private readonly ISearchForNewAuthor _searchProxy;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
|
||||
public AuthorLookupController(ISearchForNewAuthor searchProxy)
|
||||
public AuthorLookupController(ISearchForNewAuthor searchProxy, IMapCoversToLocal coverMapper)
|
||||
{
|
||||
_searchProxy = searchProxy;
|
||||
_coverMapper = coverMapper;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -24,12 +26,16 @@ namespace Readarr.Api.V1.Author
|
||||
return MapToResource(searchResults).ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<AuthorResource> MapToResource(IEnumerable<NzbDrone.Core.Books.Author> author)
|
||||
private IEnumerable<AuthorResource> MapToResource(IEnumerable<NzbDrone.Core.Books.Author> author)
|
||||
{
|
||||
foreach (var currentAuthor in author)
|
||||
{
|
||||
var resource = currentAuthor.ToResource();
|
||||
|
||||
_coverMapper.ConvertToLocalUrls(resource.Id, MediaCoverEntity.Author, resource.Images);
|
||||
|
||||
var poster = currentAuthor.Metadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
||||
|
||||
if (poster != null)
|
||||
{
|
||||
resource.RemotePoster = poster.Url;
|
||||
|
||||
Reference in New Issue
Block a user