Mercurial > minori
comparison src/core/anime_db.cc @ 286:53e3c015a973
anime: initial cross-service support
currently the Kitsu and MAL services don't work when chosen in the
GUI. This is because they haven't been implemented yet :)
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Wed, 08 May 2024 16:44:27 -0400 |
| parents | e66ffc338d82 |
| children | b1f4d1867ab1 |
comparison
equal
deleted
inserted
replaced
| 285:65df2813d0de | 286:53e3c015a973 |
|---|---|
| 177 std::optional<std::string> title = anime.GetTitle(lang); | 177 std::optional<std::string> title = anime.GetTitle(lang); |
| 178 if (title.has_value()) | 178 if (title.has_value()) |
| 179 json["title"][Strings::ToLower(Translate::ToString(lang))] = title.value(); | 179 json["title"][Strings::ToLower(Translate::ToString(lang))] = title.value(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 for (const auto& service : Services) { | |
| 183 std::optional<std::string> id = anime.GetServiceId(service); | |
| 184 if (id.has_value()) | |
| 185 json["ids"][Strings::ToLower(Translate::ToString(service))] = id.value(); | |
| 186 } | |
| 187 | |
| 182 nlohmann::json user; | 188 nlohmann::json user; |
| 183 if (GetListDataAsJSON(anime, user)) | 189 if (GetListDataAsJSON(anime, user)) |
| 184 json.push_back({"list_data", user}); | 190 json.push_back({"list_data", user}); |
| 185 | 191 |
| 186 return true; | 192 return true; |
