comparison src/services/anilist.cpp @ 73:f1fc8b04bc63

...: merge heads
author Paper <mrpapersonic@gmail.com>
date Tue, 03 Oct 2023 05:00:08 -0400
parents 64e5f427c6a2
children 5ccb99bfa605
comparison
equal deleted inserted replaced
72:893ad99b174d 73:f1fc8b04bc63
96 96
97 anime.SetUserStatus(map[status]); 97 anime.SetUserStatus(map[status]);
98 } 98 }
99 99
100 std::string ListStatusToString(const Anime::Anime& anime) { 100 std::string ListStatusToString(const Anime::Anime& anime) {
101 std::unordered_map<Anime::ListStatus, std::string> map = {
102 {Anime::ListStatus::CURRENT, "CURRENT" },
103 {Anime::ListStatus::PLANNING, "PLANNING" },
104 {Anime::ListStatus::COMPLETED, "COMPLETED"},
105 {Anime::ListStatus::DROPPED, "DROPPED" },
106 {Anime::ListStatus::PAUSED, "PAUSED" }
107 };
108
109 if (anime.GetUserIsRewatching()) 101 if (anime.GetUserIsRewatching())
110 return "REWATCHING"; 102 return "REWATCHING";
111 103
112 if (map.find(anime.GetUserStatus()) == map.end()) 104 switch (anime.GetUserStatus()) {
113 return "CURRENT"; 105 case Anime::ListStatus::PLANNING:
114 return map[anime.GetUserStatus()]; 106 return "PLANNING";
107 case Anime::ListStatus::COMPLETED:
108 return "COMPLETED";
109 case Anime::ListStatus::DROPPED:
110 return "DROPPED";
111 case Anime::ListStatus::PAUSED:
112 return "PAUSED";
113 default:
114 break;
115 }
116 return "CURRENT";
115 } 117 }
116 118
117 Date ParseDate(const nlohmann::json& json) { 119 Date ParseDate(const nlohmann::json& json) {
118 Date date; 120 Date date;
119 /* JSON for Modern C++ warns here. I'm not too sure why, this code works when I set the 121 /* JSON for Modern C++ warns here. I'm not too sure why, this code works when I set the