Mercurial > minori
annotate include/core/anime.h @ 224:7ca56c4ac0bc
about: don't abuse QCoreApplication:tr
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 08 Jan 2024 17:05:08 -0500 |
parents | 649786bae914 |
children | c130f47f6f48 |
rev | line source |
---|---|
9 | 1 #ifndef __core__anime_h |
2 #define __core__anime_h | |
3 #include "core/date.h" | |
4 #include <array> | |
5 #include <map> | |
6 #include <vector> | |
7 | |
8 namespace Anime { | |
9 | |
10 enum class ListStatus { | |
11 NOT_IN_LIST, | |
12 CURRENT, | |
13 COMPLETED, | |
51 | 14 PAUSED, |
9 | 15 DROPPED, |
51 | 16 PLANNING |
9 | 17 }; |
18 | |
15 | 19 constexpr std::array<ListStatus, 5> ListStatuses{ListStatus::CURRENT, ListStatus::COMPLETED, ListStatus::PAUSED, |
20 ListStatus::DROPPED, ListStatus::PLANNING}; | |
9 | 21 |
22 enum class SeriesStatus { | |
23 UNKNOWN, | |
24 FINISHED, | |
25 RELEASING, | |
26 NOT_YET_RELEASED, | |
27 CANCELLED, | |
28 HIATUS | |
29 }; | |
30 | |
31 enum class SeriesFormat { | |
32 UNKNOWN, | |
33 TV, | |
34 TV_SHORT, | |
35 MOVIE, | |
36 SPECIAL, | |
37 OVA, | |
38 ONA, | |
39 MUSIC, | |
40 MANGA, | |
41 NOVEL, | |
42 ONE_SHOT | |
43 }; | |
44 | |
45 enum class SeriesSeason { | |
46 UNKNOWN, | |
47 WINTER, | |
48 SPRING, | |
49 SUMMER, | |
50 FALL | |
51 }; | |
52 | |
53 enum class TitleLanguage { | |
54 ROMAJI, | |
55 NATIVE, | |
56 ENGLISH | |
57 }; | |
58 | |
59 enum class Services { | |
60 NONE, | |
61 ANILIST, | |
62 NB_SERVICES | |
63 }; | |
64 | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
65 enum class ScoreFormat { |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
66 POINT_100, // 0-100 |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
67 POINT_10_DECIMAL, // 0.0-10.0 |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
68 POINT_10, // 0-10 |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
69 POINT_5, // 0-5, should be represented in stars |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
70 POINT_3 // 1-3, should be represented in smileys |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
71 }; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
72 |
189 | 73 constexpr std::array<ScoreFormat, 5> ScoreFormats{ScoreFormat::POINT_100, ScoreFormat::POINT_10_DECIMAL, ScoreFormat::POINT_10, |
74 ScoreFormat::POINT_5, ScoreFormat::POINT_3}; | |
75 | |
9 | 76 struct ListInformation { |
15 | 77 int id = 0; |
78 int progress = 0; | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
79 int score = 0; // note that this will ALWAYS be in POINT_100 format and must be converted |
15 | 80 ListStatus status = ListStatus::NOT_IN_LIST; |
81 Date started; | |
82 Date completed; | |
83 bool is_private = false; | |
84 unsigned int rewatched_times = 0; | |
85 bool rewatching = false; | |
86 uint64_t updated = 0; | |
87 std::string notes; | |
9 | 88 }; |
89 | |
90 struct SeriesInformation { | |
15 | 91 int id; |
92 struct { | |
93 std::string romaji; | |
94 std::string english; | |
95 std::string native; | |
96 } title; | |
97 std::vector<std::string> synonyms; | |
98 int episodes = 0; | |
99 SeriesStatus status = SeriesStatus::UNKNOWN; | |
100 Date air_date; | |
101 std::vector<std::string> genres; | |
102 std::vector<std::string> producers; | |
103 SeriesFormat format = SeriesFormat::UNKNOWN; | |
104 SeriesSeason season = SeriesSeason::UNKNOWN; | |
105 int audience_score = 0; | |
106 std::string synopsis; | |
107 int duration = 0; | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
108 std::string poster_url; |
9 | 109 }; |
110 | |
111 class Anime { | |
112 public: | |
113 /* User list data */ | |
114 ListStatus GetUserStatus() const; | |
115 int GetUserProgress() const; | |
116 int GetUserScore() const; | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
117 std::string GetUserPresentableScore() const; |
9 | 118 Date GetUserDateStarted() const; |
119 Date GetUserDateCompleted() const; | |
120 bool GetUserIsPrivate() const; | |
121 unsigned int GetUserRewatchedTimes() const; | |
122 bool GetUserIsRewatching() const; | |
123 uint64_t GetUserTimeUpdated() const; | |
124 std::string GetUserNotes() const; | |
125 | |
126 void SetUserStatus(ListStatus status); | |
10 | 127 void SetUserScore(int score); |
9 | 128 void SetUserProgress(int progress); |
129 void SetUserDateStarted(Date const& started); | |
130 void SetUserDateCompleted(Date const& completed); | |
131 void SetUserIsPrivate(bool is_private); | |
132 void SetUserRewatchedTimes(int rewatched); | |
133 void SetUserIsRewatching(bool rewatching); | |
134 void SetUserTimeUpdated(uint64_t updated); | |
135 void SetUserNotes(std::string const& notes); | |
136 | |
137 /* Series data */ | |
138 int GetId() const; | |
139 std::string GetRomajiTitle() const; | |
140 std::string GetEnglishTitle() const; | |
141 std::string GetNativeTitle() const; | |
142 std::vector<std::string> GetTitleSynonyms() const; | |
143 int GetEpisodes() const; | |
144 SeriesStatus GetAiringStatus() const; | |
145 Date GetAirDate() const; | |
146 std::vector<std::string> GetGenres() const; | |
147 std::vector<std::string> GetProducers() const; | |
148 SeriesFormat GetFormat() const; | |
149 SeriesSeason GetSeason() const; | |
150 int GetAudienceScore() const; /* should be double once MAL and Kitsu are implemented */ | |
151 std::string GetSynopsis() const; | |
152 int GetDuration() const; | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
153 std::string GetPosterUrl() const; |
67
442065432549
poster: make posters link to AniList
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
154 std::string GetServiceUrl() const; |
9 | 155 |
156 void SetId(int id); | |
157 void SetRomajiTitle(std::string const& title); | |
158 void SetEnglishTitle(std::string const& title); | |
159 void SetNativeTitle(std::string const& title); | |
160 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | |
161 void AddTitleSynonym(std::string const& synonym); | |
162 void SetEpisodes(int episodes); | |
163 void SetAiringStatus(SeriesStatus status); | |
164 void SetAirDate(Date const& date); | |
165 void SetGenres(std::vector<std::string> const& genres); | |
166 void SetProducers(std::vector<std::string> const& producers); | |
167 void SetFormat(SeriesFormat format); | |
168 void SetSeason(SeriesSeason season); | |
169 void SetAudienceScore(int audience_score); | |
170 void SetSynopsis(std::string synopsis); | |
171 void SetDuration(int duration); | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
172 void SetPosterUrl(std::string poster); |
9 | 173 |
174 std::string GetUserPreferredTitle() const; | |
175 | |
176 /* User stuff */ | |
177 void AddToUserList(); | |
178 bool IsInUserList() const; | |
179 void RemoveFromUserList(); | |
180 | |
181 private: | |
182 SeriesInformation info_; | |
10 | 183 std::shared_ptr<struct ListInformation> list_info_; |
9 | 184 }; |
185 | |
186 } // namespace Anime | |
187 | |
51 | 188 #endif // __core__anime_h |