comparison src/core/anime_db.cc @ 279:657fda1b9cac

*: clean up enums
author Paper <paper@paper.us.eu.org>
date Fri, 19 Apr 2024 13:24:06 -0400
parents 9a04802848c0
children e66ffc338d82
comparison
equal deleted inserted replaced
274:f6a756c19bfb 279:657fda1b9cac
25 25
26 return total; 26 return total;
27 } 27 }
28 28
29 size_t Database::GetListsAnimeAmount(ListStatus status) { 29 size_t Database::GetListsAnimeAmount(ListStatus status) {
30 if (status == ListStatus::NOT_IN_LIST) 30 if (status == ListStatus::NotInList)
31 return 0; 31 return 0;
32 32
33 size_t total = 0; 33 size_t total = 0;
34 34
35 for (const auto& [id, anime] : items) 35 for (const auto& [id, anime] : items)
167 {"airing_status", Translate::ToString(anime.GetAiringStatus())}, 167 {"airing_status", Translate::ToString(anime.GetAiringStatus())},
168 {"air_date", anime.GetAirDate().GetAsAniListJson()}, 168 {"air_date", anime.GetAirDate().GetAsAniListJson()},
169 {"genres", anime.GetGenres()}, 169 {"genres", anime.GetGenres()},
170 {"producers", anime.GetProducers()}, 170 {"producers", anime.GetProducers()},
171 {"format", Translate::ToString(anime.GetFormat())}, 171 {"format", Translate::ToString(anime.GetFormat())},
172 {"season", Translate::ToString(anime.GetSeason())}, 172 // {"season", Translate::ToString(anime.GetSeason())},
173 {"audience_score", anime.GetAudienceScore()}, 173 {"audience_score", anime.GetAudienceScore()},
174 {"synopsis", anime.GetSynopsis()}, 174 {"synopsis", anime.GetSynopsis()},
175 {"duration", anime.GetDuration()}, 175 {"duration", anime.GetDuration()},
176 {"poster_url", anime.GetPosterUrl()} 176 {"poster_url", anime.GetPosterUrl()}
177 }; 177 };
245 Translate::ToSeriesStatus(JSON::GetString<std::string>(json, "/airing_status"_json_pointer, ""))); 245 Translate::ToSeriesStatus(JSON::GetString<std::string>(json, "/airing_status"_json_pointer, "")));
246 anime.SetAirDate(Date(JSON::GetValue(json, "/air_date"_json_pointer))); 246 anime.SetAirDate(Date(JSON::GetValue(json, "/air_date"_json_pointer)));
247 anime.SetGenres(JSON::GetArray<std::vector<std::string>>(json, "/genres"_json_pointer, {})); 247 anime.SetGenres(JSON::GetArray<std::vector<std::string>>(json, "/genres"_json_pointer, {}));
248 anime.SetProducers(JSON::GetArray<std::vector<std::string>>(json, "/producers"_json_pointer, {})); 248 anime.SetProducers(JSON::GetArray<std::vector<std::string>>(json, "/producers"_json_pointer, {}));
249 anime.SetFormat(Translate::ToSeriesFormat(JSON::GetString<std::string>(json, "/format"_json_pointer, ""))); 249 anime.SetFormat(Translate::ToSeriesFormat(JSON::GetString<std::string>(json, "/format"_json_pointer, "")));
250 anime.SetSeason(Translate::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, ""))); 250 // anime.SetSeason(Translate::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, "")));
251 anime.SetAudienceScore(JSON::GetNumber(json, "/audience_score"_json_pointer, 0)); 251 anime.SetAudienceScore(JSON::GetNumber(json, "/audience_score"_json_pointer, 0));
252 anime.SetSynopsis(JSON::GetString<std::string>(json, "/synopsis"_json_pointer, "")); 252 anime.SetSynopsis(JSON::GetString<std::string>(json, "/synopsis"_json_pointer, ""));
253 anime.SetDuration(JSON::GetNumber(json, "/duration"_json_pointer, 0)); 253 anime.SetDuration(JSON::GetNumber(json, "/duration"_json_pointer, 0));
254 anime.SetPosterUrl(JSON::GetString<std::string>(json, "/poster_url"_json_pointer, "")); 254 anime.SetPosterUrl(JSON::GetString<std::string>(json, "/poster_url"_json_pointer, ""));
255 255