Mercurial > minori
annotate include/core/anime.h @ 282:19eb6c4dca78
autotools: ax_have_qt sucks, use pkgconf instead
this is particularly useful because m4_ax_have_qt really
sucked when cross compiling because of qmake
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 08 May 2024 15:54:10 -0400 |
parents | 657fda1b9cac |
children | e66ffc338d82 |
rev | line source |
---|---|
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
1 #ifndef MINORI_CORE_ANIME_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
2 #define MINORI_CORE_ANIME_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
3 |
9 | 4 #include "core/date.h" |
5 #include <array> | |
6 #include <map> | |
7 #include <vector> | |
264 | 8 #include <optional> |
9 | 9 |
10 namespace Anime { | |
11 | |
12 enum class ListStatus { | |
279 | 13 NotInList = 0, |
14 Current, | |
15 Completed, | |
16 Paused, | |
17 Dropped, | |
18 Planning | |
19 }; | |
20 | |
21 constexpr std::array<ListStatus, 5> ListStatuses{ | |
22 ListStatus::Current, ListStatus::Completed, ListStatus::Paused, | |
23 ListStatus::Dropped, ListStatus::Planning | |
9 | 24 }; |
25 | |
279 | 26 enum class SeriesStatus { |
27 Unknown = 0, | |
28 Finished, | |
29 Releasing, | |
30 NotYetReleased, | |
31 Cancelled, | |
32 Hiatus | |
33 }; | |
9 | 34 |
279 | 35 constexpr std::array<SeriesStatus, 6> SeriesStatuses{ |
36 SeriesStatus::Unknown, | |
37 SeriesStatus::Finished, | |
38 SeriesStatus::Releasing, | |
39 SeriesStatus::NotYetReleased, | |
40 SeriesStatus::Cancelled, | |
41 SeriesStatus::Hiatus | |
9 | 42 }; |
43 | |
44 enum class SeriesFormat { | |
279 | 45 Unknown = 0, |
46 Tv, | |
47 TvShort, | |
48 Movie, | |
49 Special, | |
50 Ova, | |
51 Ona, | |
52 Music | |
53 }; | |
54 | |
55 constexpr std::array<SeriesFormat, 8> SeriesFormats{ | |
56 SeriesFormat::Unknown, | |
57 SeriesFormat::Tv, | |
58 SeriesFormat::TvShort, | |
59 SeriesFormat::Movie, | |
60 SeriesFormat::Special, | |
61 SeriesFormat::Ova, | |
62 SeriesFormat::Ona, | |
63 SeriesFormat::Music | |
9 | 64 }; |
65 | |
66 enum class SeriesSeason { | |
279 | 67 Unknown = 0, |
68 Winter, | |
69 Spring, | |
70 Summer, | |
71 Fall | |
9 | 72 }; |
73 | |
260
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
74 constexpr std::array<SeriesSeason, 4> SeriesSeasons{ |
279 | 75 SeriesSeason::Winter, SeriesSeason::Spring, |
76 SeriesSeason::Summer, SeriesSeason::Fall | |
260
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
77 }; |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
78 |
9 | 79 enum class TitleLanguage { |
279 | 80 Romaji, |
81 Native, | |
82 English | |
9 | 83 }; |
84 | |
279 | 85 constexpr std::array<TitleLanguage, 3> TitleLanguages{TitleLanguage::Romaji, TitleLanguage::Native, TitleLanguage::English}; |
86 | |
87 enum class Service { | |
88 None, | |
89 AniList | |
9 | 90 }; |
91 | |
279 | 92 constexpr std::array<Service, 1> Services{Service::AniList}; |
93 | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
94 enum class ScoreFormat { |
279 | 95 Point100, // 0-100 |
96 Point10Decimal, // 0.0-10.0 | |
97 Point10, // 0-10 | |
98 Point5, // 0-5, should be represented in stars | |
99 Point3 // 1-3, should be represented in smileys | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
100 }; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
101 |
279 | 102 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::Point100, ScoreFormat::Point10Decimal, |
103 ScoreFormat::Point10, ScoreFormat::Point5, ScoreFormat::Point3}; | |
189 | 104 |
9 | 105 struct ListInformation { |
258 | 106 int id = 0; |
107 int progress = 0; | |
279 | 108 int score = 0; // this will ALWAYS be in POINT_100 format internally |
109 ListStatus status = ListStatus::NotInList; | |
258 | 110 Date started; |
111 Date completed; | |
112 bool is_private = false; | |
113 unsigned int rewatched_times = 0; | |
114 bool rewatching = false; | |
115 uint64_t updated = 0; | |
116 std::string notes; | |
9 | 117 }; |
118 | |
119 struct SeriesInformation { | |
258 | 120 int id; |
121 struct { | |
122 std::string romaji; | |
123 std::string english; | |
124 std::string native; | |
125 } title; | |
126 std::vector<std::string> synonyms; | |
127 int episodes = 0; | |
279 | 128 SeriesStatus status = SeriesStatus::Unknown; |
258 | 129 Date air_date; |
130 std::vector<std::string> genres; | |
131 std::vector<std::string> producers; | |
279 | 132 SeriesFormat format = SeriesFormat::Unknown; |
258 | 133 int audience_score = 0; |
134 std::string synopsis; | |
135 int duration = 0; | |
136 std::string poster_url; | |
9 | 137 }; |
138 | |
139 class Anime { | |
258 | 140 public: |
141 /* User list data */ | |
142 ListStatus GetUserStatus() const; | |
143 int GetUserProgress() const; | |
144 int GetUserScore() const; | |
145 std::string GetUserPresentableScore() const; | |
146 Date GetUserDateStarted() const; | |
147 Date GetUserDateCompleted() const; | |
148 bool GetUserIsPrivate() const; | |
149 unsigned int GetUserRewatchedTimes() const; | |
150 bool GetUserIsRewatching() const; | |
151 uint64_t GetUserTimeUpdated() const; | |
152 std::string GetUserNotes() const; | |
9 | 153 |
258 | 154 void SetUserStatus(ListStatus status); |
155 void SetUserScore(int score); | |
156 void SetUserProgress(int progress); | |
157 void SetUserDateStarted(Date const& started); | |
158 void SetUserDateCompleted(Date const& completed); | |
159 void SetUserIsPrivate(bool is_private); | |
160 void SetUserRewatchedTimes(int rewatched); | |
161 void SetUserIsRewatching(bool rewatching); | |
162 void SetUserTimeUpdated(uint64_t updated); | |
163 void SetUserNotes(std::string const& notes); | |
9 | 164 |
258 | 165 /* Series data */ |
166 int GetId() const; | |
167 std::string GetRomajiTitle() const; | |
168 std::string GetEnglishTitle() const; | |
169 std::string GetNativeTitle() const; | |
170 std::vector<std::string> GetTitleSynonyms() const; | |
171 int GetEpisodes() const; | |
172 SeriesStatus GetAiringStatus() const; | |
173 Date GetAirDate() const; | |
174 std::vector<std::string> GetGenres() const; | |
175 std::vector<std::string> GetProducers() const; | |
176 SeriesFormat GetFormat() const; | |
177 SeriesSeason GetSeason() const; | |
178 int GetAudienceScore() const; | |
179 std::string GetSynopsis() const; | |
180 int GetDuration() const; | |
181 std::string GetPosterUrl() const; | |
182 std::string GetServiceUrl() const; | |
9 | 183 |
258 | 184 void SetId(int id); |
185 void SetRomajiTitle(std::string const& title); | |
186 void SetEnglishTitle(std::string const& title); | |
187 void SetNativeTitle(std::string const& title); | |
188 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | |
189 void AddTitleSynonym(std::string const& synonym); | |
190 void SetEpisodes(int episodes); | |
191 void SetAiringStatus(SeriesStatus status); | |
192 void SetAirDate(Date const& date); | |
193 void SetGenres(std::vector<std::string> const& genres); | |
194 void SetProducers(std::vector<std::string> const& producers); | |
195 void SetFormat(SeriesFormat format); | |
196 void SetAudienceScore(int audience_score); | |
197 void SetSynopsis(std::string synopsis); | |
198 void SetDuration(int duration); | |
199 void SetPosterUrl(std::string poster); | |
9 | 200 |
258 | 201 std::string GetUserPreferredTitle() const; |
9 | 202 |
258 | 203 /* User stuff */ |
204 void AddToUserList(); | |
205 bool IsInUserList() const; | |
206 void RemoveFromUserList(); | |
9 | 207 |
258 | 208 private: |
209 SeriesInformation info_; | |
264 | 210 std::optional<struct ListInformation> list_info_ = std::nullopt; |
9 | 211 }; |
212 | |
213 } // namespace Anime | |
214 | |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
215 #endif // MINORI_CORE_ANIME_H_ |