Mercurial > minori
diff src/services/anilist.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 | 1686fac290c5 |
children | 78929794e7d8 |
line wrap: on
line diff
--- a/src/services/anilist.cc Wed Jun 12 22:48:16 2024 -0400 +++ b/src/services/anilist.cc Wed Jun 12 23:03:22 2024 -0400 @@ -51,6 +51,11 @@ " month\n" \ " day\n" \ "}\n" \ + "endDate {\n" \ + " year\n" \ + " month\n" \ + " day\n" \ + "}\n" \ "studios {\n" \ " edges {\n" \ " node {\n" \ @@ -190,7 +195,13 @@ anime.SetAiringStatus( Translate::AniList::ToSeriesStatus(JSON::GetString<std::string>(json, "/status"_json_pointer, ""))); - anime.SetAirDate(Date(json["/startDate"_json_pointer])); + if (json.contains("/startDate"_json_pointer) && json["/startDate"_json_pointer].is_object()) + anime.SetStartedDate(Date(json["/startDate"_json_pointer])); + + if (json.contains("/endDate"_json_pointer) && json["/endDate"_json_pointer].is_object()) + anime.SetCompletedDate(Date(json["/endDate"_json_pointer])); + else + anime.SetCompletedDate(anime.GetStartedDate()); anime.SetPosterUrl(JSON::GetString<std::string>(json, "/coverImage/large"_json_pointer, ""));