Mercurial > minori
diff src/services/anilist.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 | 9a88e1725fd2 |
line wrap: on
line diff
--- a/src/services/anilist.cc Wed May 08 16:43:32 2024 -0400 +++ b/src/services/anilist.cc Wed May 08 16:44:27 2024 -0400 @@ -26,7 +26,7 @@ namespace Services { namespace AniList { -constexpr int CLIENT_ID = 13706; +static constexpr int CLIENT_ID = 13706; class Account { public: @@ -34,7 +34,7 @@ void SetUserId(const int id) { session.config.auth.anilist.user_id = id; } std::string AuthToken() const { return session.config.auth.anilist.auth_token; } - void SetAuthToken(std::string const& auth_token) { session.config.auth.anilist.auth_token = auth_token; } + void SetAuthToken(const std::string& auth_token) { session.config.auth.anilist.auth_token = auth_token; } bool Authenticated() const { return !AuthToken().empty(); } bool IsValid() const { return UserId() && Authenticated(); } @@ -130,6 +130,8 @@ Anime::Anime& anime = Anime::db.items[id]; anime.SetId(id); + anime.SetServiceId(Anime::Service::AniList, Strings::ToUtf8String(id)); + anime.SetServiceId(Anime::Service::MyAnimeList, Strings::ToUtf8String(JSON::GetNumber(json, "/id_mal"_json_pointer))); ParseTitle(json.at("/title"_json_pointer), anime); @@ -266,6 +268,7 @@ " large\n" " }\n" " id\n" + " id_mal\n" " title {\n" " romaji\n" " english\n"