Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
323:1686fac290c5 | 324:5d3c9b31aa6e |
---|---|
49 "startDate {\n" \ | 49 "startDate {\n" \ |
50 " year\n" \ | 50 " year\n" \ |
51 " month\n" \ | 51 " month\n" \ |
52 " day\n" \ | 52 " day\n" \ |
53 "}\n" \ | 53 "}\n" \ |
54 "endDate {\n" \ | |
55 " year\n" \ | |
56 " month\n" \ | |
57 " day\n" \ | |
58 "}\n" \ | |
54 "studios {\n" \ | 59 "studios {\n" \ |
55 " edges {\n" \ | 60 " edges {\n" \ |
56 " node {\n" \ | 61 " node {\n" \ |
57 " name\n" \ | 62 " name\n" \ |
58 " }\n" \ | 63 " }\n" \ |
188 anime.SetFormat(Translate::AniList::ToSeriesFormat(JSON::GetString<std::string>(json, "/format"_json_pointer, ""))); | 193 anime.SetFormat(Translate::AniList::ToSeriesFormat(JSON::GetString<std::string>(json, "/format"_json_pointer, ""))); |
189 | 194 |
190 anime.SetAiringStatus( | 195 anime.SetAiringStatus( |
191 Translate::AniList::ToSeriesStatus(JSON::GetString<std::string>(json, "/status"_json_pointer, ""))); | 196 Translate::AniList::ToSeriesStatus(JSON::GetString<std::string>(json, "/status"_json_pointer, ""))); |
192 | 197 |
193 anime.SetAirDate(Date(json["/startDate"_json_pointer])); | 198 if (json.contains("/startDate"_json_pointer) && json["/startDate"_json_pointer].is_object()) |
199 anime.SetStartedDate(Date(json["/startDate"_json_pointer])); | |
200 | |
201 if (json.contains("/endDate"_json_pointer) && json["/endDate"_json_pointer].is_object()) | |
202 anime.SetCompletedDate(Date(json["/endDate"_json_pointer])); | |
203 else | |
204 anime.SetCompletedDate(anime.GetStartedDate()); | |
194 | 205 |
195 anime.SetPosterUrl(JSON::GetString<std::string>(json, "/coverImage/large"_json_pointer, "")); | 206 anime.SetPosterUrl(JSON::GetString<std::string>(json, "/coverImage/large"_json_pointer, "")); |
196 | 207 |
197 anime.SetAudienceScore(JSON::GetNumber(json, "/averageScore"_json_pointer, 0)); | 208 anime.SetAudienceScore(JSON::GetNumber(json, "/averageScore"_json_pointer, 0)); |
198 // anime.SetSeason(Translate::AniList::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, ""))); | 209 // anime.SetSeason(Translate::AniList::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, ""))); |