Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 285:65df2813d0de | 286:53e3c015a973 |
|---|---|
| 84 | 84 |
| 85 constexpr std::array<TitleLanguage, 3> TitleLanguages{TitleLanguage::Romaji, TitleLanguage::Native, TitleLanguage::English}; | 85 constexpr std::array<TitleLanguage, 3> TitleLanguages{TitleLanguage::Romaji, TitleLanguage::Native, TitleLanguage::English}; |
| 86 | 86 |
| 87 enum class Service { | 87 enum class Service { |
| 88 None, | 88 None, |
| 89 AniList | 89 AniList, |
| 90 }; | 90 MyAnimeList, |
| 91 | 91 Kitsu |
| 92 constexpr std::array<Service, 1> Services{Service::AniList}; | 92 }; |
| 93 | |
| 94 /* this doesn't include MAL and Kitsu because they aren't really | |
| 95 * "valid" services yet. */ | |
| 96 constexpr std::array<Service, 3> Services{ | |
| 97 Service::AniList, | |
| 98 Service::MyAnimeList, | |
| 99 Service::Kitsu | |
| 100 }; | |
| 93 | 101 |
| 94 enum class ScoreFormat { | 102 enum class ScoreFormat { |
| 95 Point100, // 0-100 | 103 Point100, // 0-100 |
| 96 Point10Decimal, // 0.0-10.0 | 104 Point10Decimal, // 0.0-10.0 |
| 97 Point10, // 0-10 | 105 Point10, // 0-10 |
| 116 std::string notes; | 124 std::string notes; |
| 117 }; | 125 }; |
| 118 | 126 |
| 119 struct SeriesInformation { | 127 struct SeriesInformation { |
| 120 int id; | 128 int id; |
| 129 std::map<Service, std::string> ids; | |
| 121 std::map<TitleLanguage, std::string> titles; | 130 std::map<TitleLanguage, std::string> titles; |
| 122 std::vector<std::string> synonyms; | 131 std::vector<std::string> synonyms; |
| 123 int episodes = 0; | 132 int episodes = 0; |
| 124 SeriesStatus status = SeriesStatus::Unknown; | 133 SeriesStatus status = SeriesStatus::Unknown; |
| 125 Date air_date; | 134 Date air_date; |
| 158 void SetUserTimeUpdated(uint64_t updated); | 167 void SetUserTimeUpdated(uint64_t updated); |
| 159 void SetUserNotes(std::string const& notes); | 168 void SetUserNotes(std::string const& notes); |
| 160 | 169 |
| 161 /* Series data */ | 170 /* Series data */ |
| 162 int GetId() const; | 171 int GetId() const; |
| 172 std::optional<std::string> GetServiceId(Service service) const; | |
| 163 std::optional<std::string> GetTitle(TitleLanguage language) const; | 173 std::optional<std::string> GetTitle(TitleLanguage language) const; |
| 164 std::vector<std::string> GetTitleSynonyms() const; | 174 std::vector<std::string> GetTitleSynonyms() const; |
| 165 int GetEpisodes() const; | 175 int GetEpisodes() const; |
| 166 SeriesStatus GetAiringStatus() const; | 176 SeriesStatus GetAiringStatus() const; |
| 167 Date GetAirDate() const; | 177 Date GetAirDate() const; |
| 171 SeriesSeason GetSeason() const; | 181 SeriesSeason GetSeason() const; |
| 172 int GetAudienceScore() const; | 182 int GetAudienceScore() const; |
| 173 std::string GetSynopsis() const; | 183 std::string GetSynopsis() const; |
| 174 int GetDuration() const; | 184 int GetDuration() const; |
| 175 std::string GetPosterUrl() const; | 185 std::string GetPosterUrl() const; |
| 176 std::string GetServiceUrl() const; | 186 std::optional<std::string> GetServiceUrl(Service service) const; |
| 177 | 187 |
| 178 void SetId(int id); | 188 void SetId(int id); |
| 189 void SetServiceId(Service service, const std::string& id); | |
| 179 void SetTitle(TitleLanguage language, const std::string& title); | 190 void SetTitle(TitleLanguage language, const std::string& title); |
| 180 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | 191 void SetTitleSynonyms(std::vector<std::string> const& synonyms); |
| 181 void AddTitleSynonym(std::string const& synonym); | 192 void AddTitleSynonym(std::string const& synonym); |
| 182 void SetEpisodes(int episodes); | 193 void SetEpisodes(int episodes); |
| 183 void SetAiringStatus(SeriesStatus status); | 194 void SetAiringStatus(SeriesStatus status); |
