|
|
@ -28,7 +28,6 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
|
|
|
|
private static readonly Regex NoPhotoRegex = new Regex(@"/nophoto/(book|user)/",
|
|
|
|
private static readonly Regex NoPhotoRegex = new Regex(@"/nophoto/(book|user)/",
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
|
|
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IHttpClient _httpClient;
|
|
|
|
|
|
|
|
private readonly ICachedHttpResponseService _cachedHttpClient;
|
|
|
|
private readonly ICachedHttpResponseService _cachedHttpClient;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly IAuthorService _authorService;
|
|
|
|
private readonly IAuthorService _authorService;
|
|
|
@ -38,15 +37,13 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
|
|
|
|
private readonly IHttpRequestBuilderFactory _searchBuilder;
|
|
|
|
private readonly IHttpRequestBuilderFactory _searchBuilder;
|
|
|
|
private readonly ICached<HashSet<string>> _cache;
|
|
|
|
private readonly ICached<HashSet<string>> _cache;
|
|
|
|
|
|
|
|
|
|
|
|
public GoodreadsProxy(IHttpClient httpClient,
|
|
|
|
public GoodreadsProxy(ICachedHttpResponseService cachedHttpClient,
|
|
|
|
ICachedHttpResponseService cachedHttpClient,
|
|
|
|
|
|
|
|
IAuthorService authorService,
|
|
|
|
IAuthorService authorService,
|
|
|
|
IBookService bookService,
|
|
|
|
IBookService bookService,
|
|
|
|
IEditionService editionService,
|
|
|
|
IEditionService editionService,
|
|
|
|
Logger logger,
|
|
|
|
Logger logger,
|
|
|
|
ICacheManager cacheManager)
|
|
|
|
ICacheManager cacheManager)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_httpClient = httpClient;
|
|
|
|
|
|
|
|
_cachedHttpClient = cachedHttpClient;
|
|
|
|
_cachedHttpClient = cachedHttpClient;
|
|
|
|
_authorService = authorService;
|
|
|
|
_authorService = authorService;
|
|
|
|
_bookService = bookService;
|
|
|
|
_bookService = bookService;
|
|
|
@ -482,7 +479,7 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
|
|
|
|
.AddQueryParam("q", query)
|
|
|
|
.AddQueryParam("q", query)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var result = _httpClient.Get<List<SearchJsonResource>>(httpRequest);
|
|
|
|
var result = _cachedHttpClient.Get<List<SearchJsonResource>>(httpRequest, true, TimeSpan.FromDays(5));
|
|
|
|
|
|
|
|
|
|
|
|
return result.Resource.SelectList(MapJsonSearchResult);
|
|
|
|
return result.Resource.SelectList(MapJsonSearchResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|