mirror of
https://github.com/Readarr/Readarr
synced 2026-04-20 20:01:09 +02:00
Fixed: Parsing books written before year 1
This commit is contained in:
parent
9e5966365c
commit
ac73b9711a
3 changed files with 3 additions and 10 deletions
|
|
@ -44,6 +44,7 @@ public void should_be_able_to_get_author_detail(string mbId, string name)
|
|||
}
|
||||
|
||||
[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 @@ public static decimal ElementAsDecimal(this XElement element, XName name)
|
|||
return null;
|
||||
}
|
||||
|
||||
if (!publicationYear.HasValue)
|
||||
if (!publicationYear.HasValue || publicationYear <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,15 +119,7 @@ public override void Parse(XElement element)
|
|||
|
||||
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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue