Mercurial > minori
diff src/services/anilist.cc @ 279:657fda1b9cac
*: clean up enums
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Fri, 19 Apr 2024 13:24:06 -0400 |
parents | dd211ff68b36 |
children | e66ffc338d82 |
line wrap: on
line diff
--- a/src/services/anilist.cc Thu Apr 18 17:24:42 2024 -0400 +++ b/src/services/anilist.cc Fri Apr 19 13:24:06 2024 -0400 @@ -74,21 +74,21 @@ void ParseListStatus(std::string status, Anime::Anime& anime) { static const std::unordered_map<std::string, Anime::ListStatus> map = { - {"CURRENT", Anime::ListStatus::CURRENT }, - {"PLANNING", Anime::ListStatus::PLANNING }, - {"COMPLETED", Anime::ListStatus::COMPLETED}, - {"DROPPED", Anime::ListStatus::DROPPED }, - {"PAUSED", Anime::ListStatus::PAUSED } + {"CURRENT", Anime::ListStatus::Current }, + {"PLANNING", Anime::ListStatus::Planning }, + {"COMPLETED", Anime::ListStatus::Completed}, + {"DROPPED", Anime::ListStatus::Dropped }, + {"PAUSED", Anime::ListStatus::Paused } }; if (status == "REPEATING") { anime.SetUserIsRewatching(true); - anime.SetUserStatus(Anime::ListStatus::CURRENT); + anime.SetUserStatus(Anime::ListStatus::Current); return; } if (map.find(status) == map.end()) { - anime.SetUserStatus(Anime::ListStatus::NOT_IN_LIST); + anime.SetUserStatus(Anime::ListStatus::NotInList); return; } @@ -96,14 +96,14 @@ } std::string ListStatusToString(const Anime::Anime& anime) { - if (anime.GetUserIsRewatching()) + if (anime.GetUserIsRewatching() && anime.GetUserStatus() == Anime::ListStatus::Current) return "REWATCHING"; switch (anime.GetUserStatus()) { - case Anime::ListStatus::PLANNING: return "PLANNING"; - case Anime::ListStatus::COMPLETED: return "COMPLETED"; - case Anime::ListStatus::DROPPED: return "DROPPED"; - case Anime::ListStatus::PAUSED: return "PAUSED"; + case Anime::ListStatus::Planning: return "PLANNING"; + case Anime::ListStatus::Completed: return "COMPLETED"; + case Anime::ListStatus::Dropped: return "DROPPED"; + case Anime::ListStatus::Paused: return "PAUSED"; default: break; } return "CURRENT"; @@ -136,7 +136,7 @@ anime.SetPosterUrl(JSON::GetString<std::string>(json, "/coverImage/large"_json_pointer, "")); anime.SetAudienceScore(JSON::GetNumber(json, "/averageScore"_json_pointer, 0)); - anime.SetSeason(Translate::AniList::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, ""))); + // anime.SetSeason(Translate::AniList::ToSeriesSeason(JSON::GetString<std::string>(json, "/season"_json_pointer, ""))); anime.SetDuration(JSON::GetNumber(json, "/duration"_json_pointer, 0)); std::string synopsis = JSON::GetString<std::string>(json, "/description"_json_pointer, "");