Mercurial > minori
annotate include/core/anime.h @ 185:62e336597bb7
anime list: add support for different score formats
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 05 Dec 2023 13:45:23 -0500 |
parents | 09492158bcc5 |
children | 649786bae914 |
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 |
9 | 73 struct ListInformation { |
15 | 74 int id = 0; |
75 int progress = 0; | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
76 int score = 0; // note that this will ALWAYS be in POINT_100 format and must be converted |
15 | 77 ListStatus status = ListStatus::NOT_IN_LIST; |
78 Date started; | |
79 Date completed; | |
80 bool is_private = false; | |
81 unsigned int rewatched_times = 0; | |
82 bool rewatching = false; | |
83 uint64_t updated = 0; | |
84 std::string notes; | |
9 | 85 }; |
86 | |
87 struct SeriesInformation { | |
15 | 88 int id; |
89 struct { | |
90 std::string romaji; | |
91 std::string english; | |
92 std::string native; | |
93 } title; | |
94 std::vector<std::string> synonyms; | |
95 int episodes = 0; | |
96 SeriesStatus status = SeriesStatus::UNKNOWN; | |
97 Date air_date; | |
98 std::vector<std::string> genres; | |
99 std::vector<std::string> producers; | |
100 SeriesFormat format = SeriesFormat::UNKNOWN; | |
101 SeriesSeason season = SeriesSeason::UNKNOWN; | |
102 int audience_score = 0; | |
103 std::string synopsis; | |
104 int duration = 0; | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
105 std::string poster_url; |
9 | 106 }; |
107 | |
108 class Anime { | |
109 public: | |
110 /* User list data */ | |
111 ListStatus GetUserStatus() const; | |
112 int GetUserProgress() const; | |
113 int GetUserScore() const; | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
184
diff
changeset
|
114 std::string GetUserPresentableScore() const; |
9 | 115 Date GetUserDateStarted() const; |
116 Date GetUserDateCompleted() const; | |
117 bool GetUserIsPrivate() const; | |
118 unsigned int GetUserRewatchedTimes() const; | |
119 bool GetUserIsRewatching() const; | |
120 uint64_t GetUserTimeUpdated() const; | |
121 std::string GetUserNotes() const; | |
122 | |
123 void SetUserStatus(ListStatus status); | |
10 | 124 void SetUserScore(int score); |
9 | 125 void SetUserProgress(int progress); |
126 void SetUserDateStarted(Date const& started); | |
127 void SetUserDateCompleted(Date const& completed); | |
128 void SetUserIsPrivate(bool is_private); | |
129 void SetUserRewatchedTimes(int rewatched); | |
130 void SetUserIsRewatching(bool rewatching); | |
131 void SetUserTimeUpdated(uint64_t updated); | |
132 void SetUserNotes(std::string const& notes); | |
133 | |
134 /* Series data */ | |
135 int GetId() const; | |
136 std::string GetRomajiTitle() const; | |
137 std::string GetEnglishTitle() const; | |
138 std::string GetNativeTitle() const; | |
139 std::vector<std::string> GetTitleSynonyms() const; | |
140 int GetEpisodes() const; | |
141 SeriesStatus GetAiringStatus() const; | |
142 Date GetAirDate() const; | |
143 std::vector<std::string> GetGenres() const; | |
144 std::vector<std::string> GetProducers() const; | |
145 SeriesFormat GetFormat() const; | |
146 SeriesSeason GetSeason() const; | |
147 int GetAudienceScore() const; /* should be double once MAL and Kitsu are implemented */ | |
148 std::string GetSynopsis() const; | |
149 int GetDuration() const; | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
150 std::string GetPosterUrl() const; |
67
442065432549
poster: make posters link to AniList
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
151 std::string GetServiceUrl() const; |
9 | 152 |
153 void SetId(int id); | |
154 void SetRomajiTitle(std::string const& title); | |
155 void SetEnglishTitle(std::string const& title); | |
156 void SetNativeTitle(std::string const& title); | |
157 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | |
158 void AddTitleSynonym(std::string const& synonym); | |
159 void SetEpisodes(int episodes); | |
160 void SetAiringStatus(SeriesStatus status); | |
161 void SetAirDate(Date const& date); | |
162 void SetGenres(std::vector<std::string> const& genres); | |
163 void SetProducers(std::vector<std::string> const& producers); | |
164 void SetFormat(SeriesFormat format); | |
165 void SetSeason(SeriesSeason season); | |
166 void SetAudienceScore(int audience_score); | |
167 void SetSynopsis(std::string synopsis); | |
168 void SetDuration(int duration); | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
169 void SetPosterUrl(std::string poster); |
9 | 170 |
171 std::string GetUserPreferredTitle() const; | |
172 | |
173 /* User stuff */ | |
174 void AddToUserList(); | |
175 bool IsInUserList() const; | |
176 void RemoveFromUserList(); | |
177 | |
178 private: | |
179 SeriesInformation info_; | |
10 | 180 std::shared_ptr<struct ListInformation> list_info_; |
9 | 181 }; |
182 | |
183 } // namespace Anime | |
184 | |
51 | 185 #endif // __core__anime_h |