Mercurial > minori
annotate include/core/anime.h @ 118:39521c47c7a3
*: another huge megacommit, SORRY
The torrents page works a lot better now
Added the edit option to the anime list right click menu
Vectorized currently playing files
Available player and extensions are now loaded at runtime
from files in (dotpath)/players.json and (dotpath)/extensions.json
These paths are not permanent and will likely be moved to
(dotpath)/recognition
...
...
...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 07 Nov 2023 23:40:54 -0500 |
parents | 442065432549 |
children | 09492158bcc5 |
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 | |
65 struct ListInformation { | |
15 | 66 int id = 0; |
67 int progress = 0; | |
68 int score = 0; | |
69 ListStatus status = ListStatus::NOT_IN_LIST; | |
70 Date started; | |
71 Date completed; | |
72 bool is_private = false; | |
73 unsigned int rewatched_times = 0; | |
74 bool rewatching = false; | |
75 uint64_t updated = 0; | |
76 std::string notes; | |
9 | 77 }; |
78 | |
79 struct SeriesInformation { | |
15 | 80 int id; |
81 struct { | |
82 std::string romaji; | |
83 std::string english; | |
84 std::string native; | |
85 } title; | |
86 std::vector<std::string> synonyms; | |
87 int episodes = 0; | |
88 SeriesStatus status = SeriesStatus::UNKNOWN; | |
89 Date air_date; | |
90 std::vector<std::string> genres; | |
91 std::vector<std::string> producers; | |
92 SeriesFormat format = SeriesFormat::UNKNOWN; | |
93 SeriesSeason season = SeriesSeason::UNKNOWN; | |
94 int audience_score = 0; | |
95 std::string synopsis; | |
96 int duration = 0; | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
97 std::string poster_url; |
9 | 98 }; |
99 | |
100 class Anime { | |
101 public: | |
102 /* User list data */ | |
103 ListStatus GetUserStatus() const; | |
104 int GetUserProgress() const; | |
105 int GetUserScore() const; | |
106 Date GetUserDateStarted() const; | |
107 Date GetUserDateCompleted() const; | |
108 bool GetUserIsPrivate() const; | |
109 unsigned int GetUserRewatchedTimes() const; | |
110 bool GetUserIsRewatching() const; | |
111 uint64_t GetUserTimeUpdated() const; | |
112 std::string GetUserNotes() const; | |
113 | |
114 void SetUserStatus(ListStatus status); | |
10 | 115 void SetUserScore(int score); |
9 | 116 void SetUserProgress(int progress); |
117 void SetUserDateStarted(Date const& started); | |
118 void SetUserDateCompleted(Date const& completed); | |
119 void SetUserIsPrivate(bool is_private); | |
120 void SetUserRewatchedTimes(int rewatched); | |
121 void SetUserIsRewatching(bool rewatching); | |
122 void SetUserTimeUpdated(uint64_t updated); | |
123 void SetUserNotes(std::string const& notes); | |
124 | |
125 /* Series data */ | |
126 int GetId() const; | |
127 std::string GetRomajiTitle() const; | |
128 std::string GetEnglishTitle() const; | |
129 std::string GetNativeTitle() const; | |
130 std::vector<std::string> GetTitleSynonyms() const; | |
131 int GetEpisodes() const; | |
132 SeriesStatus GetAiringStatus() const; | |
133 Date GetAirDate() const; | |
134 std::vector<std::string> GetGenres() const; | |
135 std::vector<std::string> GetProducers() const; | |
136 SeriesFormat GetFormat() const; | |
137 SeriesSeason GetSeason() const; | |
138 int GetAudienceScore() const; /* should be double once MAL and Kitsu are implemented */ | |
139 std::string GetSynopsis() const; | |
140 int GetDuration() const; | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
141 std::string GetPosterUrl() const; |
67
442065432549
poster: make posters link to AniList
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
142 std::string GetServiceUrl() const; |
9 | 143 |
144 void SetId(int id); | |
145 void SetRomajiTitle(std::string const& title); | |
146 void SetEnglishTitle(std::string const& title); | |
147 void SetNativeTitle(std::string const& title); | |
148 void SetTitleSynonyms(std::vector<std::string> const& synonyms); | |
149 void AddTitleSynonym(std::string const& synonym); | |
150 void SetEpisodes(int episodes); | |
151 void SetAiringStatus(SeriesStatus status); | |
152 void SetAirDate(Date const& date); | |
153 void SetGenres(std::vector<std::string> const& genres); | |
154 void SetProducers(std::vector<std::string> const& producers); | |
155 void SetFormat(SeriesFormat format); | |
156 void SetSeason(SeriesSeason season); | |
157 void SetAudienceScore(int audience_score); | |
158 void SetSynopsis(std::string synopsis); | |
159 void SetDuration(int duration); | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
160 void SetPosterUrl(std::string poster); |
9 | 161 |
162 std::string GetUserPreferredTitle() const; | |
163 | |
164 /* User stuff */ | |
165 void AddToUserList(); | |
166 bool IsInUserList() const; | |
167 void RemoveFromUserList(); | |
168 | |
169 private: | |
170 SeriesInformation info_; | |
10 | 171 std::shared_ptr<struct ListInformation> list_info_; |
9 | 172 }; |
173 | |
174 } // namespace Anime | |
175 | |
51 | 176 #endif // __core__anime_h |