diff src/services/kitsu.cc @ 324:5d3c9b31aa6e

anime: add completed date member
author Paper <paper@paper.us.eu.org>
date Wed, 12 Jun 2024 23:03:22 -0400
parents 8141f409d52c
children 78929794e7d8
line wrap: on
line diff
--- a/src/services/kitsu.cc	Wed Jun 12 22:48:16 2024 -0400
+++ b/src/services/kitsu.cc	Wed Jun 12 23:03:22 2024 -0400
@@ -297,9 +297,12 @@
 		anime.SetAudienceScore(Strings::ToInt<double>(attributes["/averageRating"_json_pointer].get<std::string>()));
 
 	if (attributes.contains("/startDate"_json_pointer) && attributes["/startDate"_json_pointer].is_string())
-		anime.SetAirDate(attributes["/startDate"_json_pointer].get<std::string>());
+		anime.SetStartedDate(attributes["/startDate"_json_pointer].get<std::string>());
 
-	// XXX endDate
+	if (attributes.contains("/endDate"_json_pointer) && attributes["/endDate"_json_pointer].is_string())
+		anime.SetCompletedDate(attributes["/endDate"_json_pointer].get<std::string>());
+	else
+		anime.SetCompletedDate(anime.GetStartedDate());
 
 	if (attributes.contains("/subtype"_json_pointer) && attributes["/subtype"_json_pointer].is_string())
 		ParseSubtype(anime, attributes["/subtype"_json_pointer].get<std::string>());