Mercurial > minori
comparison include/core/anime.h @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Mon, 01 Apr 2024 02:43:44 -0400 |
| parents | c130f47f6f48 |
| children | dd211ff68b36 |
comparison
equal
deleted
inserted
replaced
| 257:699a20c57dc8 | 258:862d0d8619f6 |
|---|---|
| 61 ANILIST, | 61 ANILIST, |
| 62 NB_SERVICES | 62 NB_SERVICES |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 enum class ScoreFormat { | 65 enum class ScoreFormat { |
| 66 POINT_100, // 0-100 | 66 POINT_100, // 0-100 |
| 67 POINT_10_DECIMAL, // 0.0-10.0 | 67 POINT_10_DECIMAL, // 0.0-10.0 |
| 68 POINT_10, // 0-10 | 68 POINT_10, // 0-10 |
| 69 POINT_5, // 0-5, should be represented in stars | 69 POINT_5, // 0-5, should be represented in stars |
| 70 POINT_3 // 1-3, should be represented in smileys | 70 POINT_3 // 1-3, should be represented in smileys |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::POINT_100, ScoreFormat::POINT_10_DECIMAL, ScoreFormat::POINT_10, | 73 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::POINT_100, ScoreFormat::POINT_10_DECIMAL, |
| 74 ScoreFormat::POINT_5, ScoreFormat::POINT_3}; | 74 ScoreFormat::POINT_10, ScoreFormat::POINT_5, ScoreFormat::POINT_3}; |
| 75 | 75 |
| 76 struct ListInformation { | 76 struct ListInformation { |
| 77 int id = 0; | 77 int id = 0; |
| 78 int progress = 0; | 78 int progress = 0; |
| 79 int score = 0; // note that this will ALWAYS be in POINT_100 format and must be converted | 79 int score = 0; // note that this will ALWAYS be in POINT_100 format and must be converted |
| 80 ListStatus status = ListStatus::NOT_IN_LIST; | 80 ListStatus status = ListStatus::NOT_IN_LIST; |
| 81 Date started; | 81 Date started; |
| 82 Date completed; | 82 Date completed; |
| 83 bool is_private = false; | 83 bool is_private = false; |
| 84 unsigned int rewatched_times = 0; | 84 unsigned int rewatched_times = 0; |
| 85 bool rewatching = false; | 85 bool rewatching = false; |
| 86 uint64_t updated = 0; | 86 uint64_t updated = 0; |
| 87 std::string notes; | 87 std::string notes; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 struct SeriesInformation { | 90 struct SeriesInformation { |
| 91 int id; | 91 int id; |
| 92 struct { | 92 struct { |
| 93 std::string romaji; | 93 std::string romaji; |
| 94 std::string english; | 94 std::string english; |
| 95 std::string native; | 95 std::string native; |
| 96 } title; | 96 } title; |
| 97 std::vector<std::string> synonyms; | 97 std::vector<std::string> synonyms; |
| 98 int episodes = 0; | 98 int episodes = 0; |
| 99 SeriesStatus status = SeriesStatus::UNKNOWN; | 99 SeriesStatus status = SeriesStatus::UNKNOWN; |
| 100 Date air_date; | 100 Date air_date; |
| 101 std::vector<std::string> genres; | 101 std::vector<std::string> genres; |
| 102 std::vector<std::string> producers; | 102 std::vector<std::string> producers; |
| 103 SeriesFormat format = SeriesFormat::UNKNOWN; | 103 SeriesFormat format = SeriesFormat::UNKNOWN; |
| 104 SeriesSeason season = SeriesSeason::UNKNOWN; | 104 SeriesSeason season = SeriesSeason::UNKNOWN; |
| 105 int audience_score = 0; | 105 int audience_score = 0; |
| 106 std::string synopsis; | 106 std::string synopsis; |
| 107 int duration = 0; | 107 int duration = 0; |
| 108 std::string poster_url; | 108 std::string poster_url; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 class Anime { | 111 class Anime { |
| 112 public: | 112 public: |
| 113 /* User list data */ | 113 /* User list data */ |
| 114 ListStatus GetUserStatus() const; | 114 ListStatus GetUserStatus() const; |
| 115 int GetUserProgress() const; | 115 int GetUserProgress() const; |
| 116 int GetUserScore() const; | 116 int GetUserScore() const; |
| 117 std::string GetUserPresentableScore() const; | 117 std::string GetUserPresentableScore() const; |
| 118 Date GetUserDateStarted() const; | 118 Date GetUserDateStarted() const; |
| 119 Date GetUserDateCompleted() const; | 119 Date GetUserDateCompleted() const; |
| 120 bool GetUserIsPrivate() const; | 120 bool GetUserIsPrivate() const; |
| 121 unsigned int GetUserRewatchedTimes() const; | 121 unsigned int GetUserRewatchedTimes() const; |
| 122 bool GetUserIsRewatching() const; | 122 bool GetUserIsRewatching() const; |
| 123 uint64_t GetUserTimeUpdated() const; | 123 uint64_t GetUserTimeUpdated() const; |
| 124 std::string GetUserNotes() const; | 124 std::string GetUserNotes() const; |
| 125 | 125 |
| 126 void SetUserStatus(ListStatus status); | 126 void SetUserStatus(ListStatus status); |
| 127 void SetUserScore(int score); | 127 void SetUserScore(int score); |
| 128 void SetUserProgress(int progress); | 128 void SetUserProgress(int progress); |
| 129 void SetUserDateStarted(Date const& started); | 129 void SetUserDateStarted(Date const& started); |
| 130 void SetUserDateCompleted(Date const& completed); | 130 void SetUserDateCompleted(Date const& completed); |
| 131 void SetUserIsPrivate(bool is_private); | 131 void SetUserIsPrivate(bool is_private); |
| 132 void SetUserRewatchedTimes(int rewatched); | 132 void SetUserRewatchedTimes(int rewatched); |
| 133 void SetUserIsRewatching(bool rewatching); | 133 void SetUserIsRewatching(bool rewatching); |
| 134 void SetUserTimeUpdated(uint64_t updated); | 134 void SetUserTimeUpdated(uint64_t updated); |
| 135 void SetUserNotes(std::string const& notes); | 135 void SetUserNotes(std::string const& notes); |
| 136 | 136 |
| 137 /* Series data */ | 137 /* Series data */ |
| 138 int GetId() const; | 138 int GetId() const; |
| 139 std::string GetRomajiTitle() const; | 139 std::string GetRomajiTitle() const; |
| 140 std::string GetEnglishTitle() const; | 140 std::string GetEnglishTitle() const; |
| 141 std::string GetNativeTitle() const; | 141 std::string GetNativeTitle() const; |
| 142 std::vector<std::string> GetTitleSynonyms() const; | 142 std::vector<std::string> GetTitleSynonyms() const; |
| 143 int GetEpisodes() const; | 143 int GetEpisodes() const; |
| 144 SeriesStatus GetAiringStatus() const; | 144 SeriesStatus GetAiringStatus() const; |
| 145 Date GetAirDate() const; | 145 Date GetAirDate() const; |
| 146 std::vector<std::string> GetGenres() const; | 146 std::vector<std::string> GetGenres() const; |
| 147 std::vector<std::string> GetProducers() const; | 147 std::vector<std::string> GetProducers() const; |
| 148 SeriesFormat GetFormat() const; | 148 SeriesFormat GetFormat() const; |
| 149 SeriesSeason GetSeason() const; | 149 SeriesSeason GetSeason() const; |
| 150 int GetAudienceScore() const; | 150 int GetAudienceScore() const; |
| 151 std::string GetSynopsis() const; | 151 std::string GetSynopsis() const; |
| 152 int GetDuration() const; | 152 int GetDuration() const; |
| 153 std::string GetPosterUrl() const; | 153 std::string GetPosterUrl() const; |
| 154 std::string GetServiceUrl() const; | 154 std::string GetServiceUrl() const; |
| 155 | 155 |
| 156 void SetId(int id); | 156 void SetId(int id); |
| 157 void SetRomajiTitle(std::string const& title); | 157 void SetRomajiTitle(std::string const& title); |
| 158 void SetEnglishTitle(std::string const& title); | 158 void SetEnglishTitle(std::string const& title); |
| 159 void SetNativeTitle(std::string const& title); | 159 void SetNativeTitle(std::string const& title); |
| 160 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | 160 void SetTitleSynonyms(std::vector<std::string> const& synonyms); |
| 161 void AddTitleSynonym(std::string const& synonym); | 161 void AddTitleSynonym(std::string const& synonym); |
| 162 void SetEpisodes(int episodes); | 162 void SetEpisodes(int episodes); |
| 163 void SetAiringStatus(SeriesStatus status); | 163 void SetAiringStatus(SeriesStatus status); |
| 164 void SetAirDate(Date const& date); | 164 void SetAirDate(Date const& date); |
| 165 void SetGenres(std::vector<std::string> const& genres); | 165 void SetGenres(std::vector<std::string> const& genres); |
| 166 void SetProducers(std::vector<std::string> const& producers); | 166 void SetProducers(std::vector<std::string> const& producers); |
| 167 void SetFormat(SeriesFormat format); | 167 void SetFormat(SeriesFormat format); |
| 168 void SetSeason(SeriesSeason season); | 168 void SetSeason(SeriesSeason season); |
| 169 void SetAudienceScore(int audience_score); | 169 void SetAudienceScore(int audience_score); |
| 170 void SetSynopsis(std::string synopsis); | 170 void SetSynopsis(std::string synopsis); |
| 171 void SetDuration(int duration); | 171 void SetDuration(int duration); |
| 172 void SetPosterUrl(std::string poster); | 172 void SetPosterUrl(std::string poster); |
| 173 | 173 |
| 174 std::string GetUserPreferredTitle() const; | 174 std::string GetUserPreferredTitle() const; |
| 175 | 175 |
| 176 /* User stuff */ | 176 /* User stuff */ |
| 177 void AddToUserList(); | 177 void AddToUserList(); |
| 178 bool IsInUserList() const; | 178 bool IsInUserList() const; |
| 179 void RemoveFromUserList(); | 179 void RemoveFromUserList(); |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 SeriesInformation info_; | 182 SeriesInformation info_; |
| 183 std::shared_ptr<struct ListInformation> list_info_; | 183 std::shared_ptr<struct ListInformation> list_info_; |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 } // namespace Anime | 186 } // namespace Anime |
| 187 | 187 |
| 188 #endif // __core__anime_h | 188 #endif // __core__anime_h |
