mirror of
https://github.com/Readarr/Readarr.git
synced 2026-03-05 13:20:32 -05:00
Fixed: Parsing books written before year 1
This commit is contained in:
@@ -44,6 +44,7 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
||||
}
|
||||
|
||||
[TestCase("64216", "Guards! Guards!")]
|
||||
[TestCase("1371", "Ιλιάς")]
|
||||
public void should_be_able_to_get_book_detail(string mbId, string name)
|
||||
{
|
||||
var details = Subject.GetBookInfo(mbId);
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!publicationYear.HasValue)
|
||||
if (!publicationYear.HasValue || publicationYear <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -119,15 +119,7 @@ namespace NzbDrone.Core.MetadataSource.Goodreads
|
||||
|
||||
TextReviewsCount = element.ElementAsInt("text_reviews_count");
|
||||
|
||||
// Merge the Goodreads publication fields into one date property
|
||||
var originalPublicationYear = element.ElementAsInt("original_publication_year");
|
||||
var originalPublicationMonth = element.ElementAsInt("original_publication_month");
|
||||
var originalPublicationDay = element.ElementAsInt("original_publication_day");
|
||||
if (originalPublicationYear != 0)
|
||||
{
|
||||
OriginalPublicationDate = new DateTime(originalPublicationYear, Math.Max(originalPublicationMonth, 1), Math.Max(originalPublicationDay, 1), 0, 0, 0, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
OriginalPublicationDate = element.ElementAsMultiDateField("original_publication");
|
||||
OriginalTitle = element.ElementAsString("original_title");
|
||||
OriginalLanguageId = element.ElementAsNullableInt("original_language_id");
|
||||
MediaType = element.ElementAsString("media_type");
|
||||
|
||||
Reference in New Issue
Block a user