New: Get more candidates and include ISBN/ASIN in distance calculation

This commit is contained in:
ta264
2021-03-30 21:26:44 +01:00
parent d078dacaab
commit 9f37b1c484
5 changed files with 201 additions and 89 deletions
@@ -418,12 +418,30 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
public List<Book> SearchByIsbn(string isbn)
{
return SearchByField("isbn", isbn);
var result = SearchByField("isbn", isbn);
// we don't get isbn back in search result, but if only one result assume the query was correct
// and add in the searched isbn
if (result.Count == 1 && result[0].Editions.Value.Count == 1)
{
result[0].Editions.Value[0].Isbn13 = isbn;
}
return result;
}
public List<Book> SearchByAsin(string asin)
{
return SearchByField("isbn", asin);
var result = SearchByField("asin", asin);
// we don't get isbn back in search result, but if only one result assume the query was correct
// and add in the searched isbn
if (result.Count == 1 && result[0].Editions.Value.Count == 1)
{
result[0].Editions.Value[0].Asin = asin;
}
return result;
}
public List<Book> SearchByGoodreadsId(int id)