Mercurial > minori
diff include/core/anime.h @ 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 |
line wrap: on
line diff
--- a/include/core/anime.h Wed May 08 16:43:32 2024 -0400 +++ b/include/core/anime.h Wed May 08 16:44:27 2024 -0400 @@ -86,10 +86,18 @@ enum class Service { None, - AniList + AniList, + MyAnimeList, + Kitsu }; -constexpr std::array<Service, 1> Services{Service::AniList}; +/* this doesn't include MAL and Kitsu because they aren't really + * "valid" services yet. */ +constexpr std::array<Service, 3> Services{ + Service::AniList, + Service::MyAnimeList, + Service::Kitsu +}; enum class ScoreFormat { Point100, // 0-100 @@ -118,6 +126,7 @@ struct SeriesInformation { int id; + std::map<Service, std::string> ids; std::map<TitleLanguage, std::string> titles; std::vector<std::string> synonyms; int episodes = 0; @@ -160,6 +169,7 @@ /* Series data */ int GetId() const; + std::optional<std::string> GetServiceId(Service service) const; std::optional<std::string> GetTitle(TitleLanguage language) const; std::vector<std::string> GetTitleSynonyms() const; int GetEpisodes() const; @@ -173,9 +183,10 @@ std::string GetSynopsis() const; int GetDuration() const; std::string GetPosterUrl() const; - std::string GetServiceUrl() const; + std::optional<std::string> GetServiceUrl(Service service) const; void SetId(int id); + void SetServiceId(Service service, const std::string& id); void SetTitle(TitleLanguage language, const std::string& title); void SetTitleSynonyms(std::vector<std::string> const& synonyms); void AddTitleSynonym(std::string const& synonym);