Mercurial > minori
annotate src/core/anime.cc @ 321:8141f409d52c
services/anilist: fix getting producers
should studios and producers be stored separately?
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 20:42:44 -0400 |
parents | b1f4d1867ab1 |
children | 5d3c9b31aa6e |
rev | line source |
---|---|
9 | 1 /* |
2 * anime.cpp: defining of custom anime-related | |
3 * datatypes & variables | |
4 */ | |
5 #include "core/anime.h" | |
279 | 6 #include "core/anime_season.h" |
9 | 7 #include "core/date.h" |
8 #include "core/session.h" | |
211
7cf53145de11
strings: use templates for ToInt, std::to_string -> Strings::ToUtf8String
Paper <mrpapersonic@gmail.com>
parents:
195
diff
changeset
|
9 #include "core/strings.h" |
178
bc8d2ccff09c
win32/dark: use existing STL classes for dwmapi
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
10 |
9 | 11 #include <algorithm> |
12 #include <string> | |
13 #include <vector> | |
275
22f9aacf6ac1
osx: don't dereference NULL pointers
Paper <paper@paper.us.eu.org>
parents:
265
diff
changeset
|
14 #include <cassert> |
9 | 15 |
305
91ac90a34003
core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
16 #include <iostream> |
91ac90a34003
core/time: remove Duration class, use regular functions instead
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
17 |
9 | 18 namespace Anime { |
19 | |
20 /* User list data */ | |
21 bool Anime::IsInUserList() const { | |
264 | 22 if (list_info_.has_value()) |
9 | 23 return true; |
24 return false; | |
25 } | |
26 | |
27 void Anime::AddToUserList() { | |
265
ff0b2052b234
*: add missing utf8proc files
Paper <paper@paper.us.eu.org>
parents:
264
diff
changeset
|
28 ListInformation list; |
264 | 29 list_info_.emplace(list); |
9 | 30 } |
31 | |
32 void Anime::RemoveFromUserList() { | |
33 list_info_.reset(); | |
34 } | |
35 | |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
36 std::string Anime::GetUserId() const { |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
37 assert(list_info_.has_value()); |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
38 return list_info_->id; |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
39 } |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
40 |
9 | 41 ListStatus Anime::GetUserStatus() const { |
264 | 42 assert(list_info_.has_value()); |
9 | 43 return list_info_->status; |
44 } | |
45 | |
46 int Anime::GetUserProgress() const { | |
264 | 47 assert(list_info_.has_value()); |
9 | 48 return list_info_->progress; |
49 } | |
50 | |
51 int Anime::GetUserScore() const { | |
264 | 52 assert(list_info_.has_value()); |
9 | 53 return list_info_->score; |
54 } | |
55 | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
56 std::string Anime::GetUserPresentableScore() const { |
264 | 57 assert(list_info_.has_value()); |
279 | 58 |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
59 const int score = list_info_->score; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
60 if (score == 0) |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
61 return ""; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
62 |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
63 switch (session.config.anime_list.score_format) { |
279 | 64 case ScoreFormat::Point10Decimal: |
211
7cf53145de11
strings: use templates for ToInt, std::to_string -> Strings::ToUtf8String
Paper <mrpapersonic@gmail.com>
parents:
195
diff
changeset
|
65 return Strings::ToUtf8String(score / 10) + "." + Strings::ToUtf8String(score % 10); |
279 | 66 case ScoreFormat::Point10: return Strings::ToUtf8String(score / 10); |
67 case ScoreFormat::Point5: { | |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
68 std::string stars = ""; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
69 |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
70 for (int i = 0; i < 100; i += 20) |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
71 stars.append((i <= score) ? "★" : "☆"); |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
72 |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
73 return stars; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
74 } |
279 | 75 case ScoreFormat::Point3: { |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
76 if (score >= 100) |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
77 return ":)"; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
78 else if (score >= 66) |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
79 return ":|"; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
80 else if (score >= 33) |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
81 return ":("; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
82 else |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
83 return ""; |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
84 } |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
85 default: |
279 | 86 case ScoreFormat::Point100: return Strings::ToUtf8String(score); |
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
87 } |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
88 } |
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
183
diff
changeset
|
89 |
9 | 90 Date Anime::GetUserDateStarted() const { |
264 | 91 assert(list_info_.has_value()); |
9 | 92 return list_info_->started; |
93 } | |
94 | |
95 Date Anime::GetUserDateCompleted() const { | |
264 | 96 assert(list_info_.has_value()); |
9 | 97 return list_info_->completed; |
98 } | |
99 | |
100 bool Anime::GetUserIsPrivate() const { | |
264 | 101 assert(list_info_.has_value()); |
9 | 102 return list_info_->is_private; |
103 } | |
104 | |
105 unsigned int Anime::GetUserRewatchedTimes() const { | |
264 | 106 assert(list_info_.has_value()); |
9 | 107 return list_info_->rewatched_times; |
108 } | |
109 | |
110 bool Anime::GetUserIsRewatching() const { | |
264 | 111 assert(list_info_.has_value()); |
9 | 112 return list_info_->rewatching; |
113 } | |
114 | |
115 uint64_t Anime::GetUserTimeUpdated() const { | |
264 | 116 assert(list_info_.has_value()); |
9 | 117 return list_info_->updated; |
118 } | |
119 | |
120 std::string Anime::GetUserNotes() const { | |
264 | 121 assert(list_info_.has_value()); |
9 | 122 return list_info_->notes; |
123 } | |
124 | |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
125 void Anime::SetUserId(const std::string& id) { |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
126 assert(list_info_.has_value()); |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
127 list_info_->id = id; |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
128 } |
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
129 |
9 | 130 void Anime::SetUserStatus(ListStatus status) { |
264 | 131 assert(list_info_.has_value()); |
9 | 132 list_info_->status = status; |
133 } | |
134 | |
10 | 135 void Anime::SetUserScore(int score) { |
264 | 136 assert(list_info_.has_value()); |
10 | 137 list_info_->score = score; |
138 } | |
139 | |
9 | 140 void Anime::SetUserProgress(int progress) { |
264 | 141 assert(list_info_.has_value()); |
9 | 142 list_info_->progress = progress; |
143 } | |
144 | |
145 void Anime::SetUserDateStarted(Date const& started) { | |
264 | 146 assert(list_info_.has_value()); |
9 | 147 list_info_->started = started; |
148 } | |
149 | |
150 void Anime::SetUserDateCompleted(Date const& completed) { | |
264 | 151 assert(list_info_.has_value()); |
9 | 152 list_info_->completed = completed; |
153 } | |
154 | |
155 void Anime::SetUserIsPrivate(bool is_private) { | |
264 | 156 assert(list_info_.has_value()); |
9 | 157 list_info_->is_private = is_private; |
158 } | |
159 | |
160 void Anime::SetUserRewatchedTimes(int rewatched) { | |
264 | 161 assert(list_info_.has_value()); |
9 | 162 list_info_->rewatched_times = rewatched; |
163 } | |
164 | |
165 void Anime::SetUserIsRewatching(bool rewatching) { | |
264 | 166 assert(list_info_.has_value()); |
9 | 167 list_info_->rewatching = rewatching; |
168 } | |
169 | |
170 void Anime::SetUserTimeUpdated(uint64_t updated) { | |
264 | 171 assert(list_info_.has_value()); |
9 | 172 list_info_->updated = updated; |
173 } | |
174 | |
175 void Anime::SetUserNotes(std::string const& notes) { | |
264 | 176 assert(list_info_.has_value()); |
9 | 177 list_info_->notes = notes; |
178 } | |
179 | |
180 /* Series data */ | |
181 int Anime::GetId() const { | |
182 return info_.id; | |
183 } | |
184 | |
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
185 std::optional<std::string> Anime::GetServiceId(Service service) const { |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
186 if (info_.ids.find(service) == info_.ids.end()) |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
187 return std::nullopt; |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
188 |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
189 return info_.ids.at(service); |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
190 } |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
191 |
284
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
192 /* note: this should use std::optional */ |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
193 std::optional<std::string> Anime::GetTitle(TitleLanguage language) const { |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
194 if (info_.titles.find(language) == info_.titles.end()) |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
195 return std::nullopt; |
9 | 196 |
284
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
197 return info_.titles.at(language); |
9 | 198 } |
199 | |
200 std::vector<std::string> Anime::GetTitleSynonyms() const { | |
284
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
201 /* mainly for the GUI */ |
9 | 202 std::vector<std::string> result; |
195
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
203 |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
204 auto add_to_synonyms = [this](std::vector<std::string>& vec, std::string key) { |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
205 if (!key.empty() && !std::count(vec.begin(), vec.end(), key) && key != GetUserPreferredTitle()) |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
206 vec.push_back(key); |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
207 }; |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
208 |
284
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
209 for (const auto& lang : TitleLanguages) |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
210 if (info_.titles.find(lang) != info_.titles.end()) |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
211 add_to_synonyms(result, info_.titles.at(lang)); |
195
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
212 |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
213 for (auto& synonym : info_.synonyms) |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
214 add_to_synonyms(result, synonym); |
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
186
diff
changeset
|
215 |
9 | 216 return result; |
217 } | |
218 | |
219 int Anime::GetEpisodes() const { | |
220 return info_.episodes; | |
221 } | |
222 | |
223 SeriesStatus Anime::GetAiringStatus() const { | |
224 return info_.status; | |
225 } | |
226 | |
227 Date Anime::GetAirDate() const { | |
228 return info_.air_date; | |
229 } | |
230 | |
231 std::vector<std::string> Anime::GetGenres() const { | |
232 return info_.genres; | |
233 } | |
234 | |
235 std::vector<std::string> Anime::GetProducers() const { | |
236 return info_.producers; | |
237 } | |
238 | |
239 SeriesFormat Anime::GetFormat() const { | |
240 return info_.format; | |
241 } | |
242 | |
243 SeriesSeason Anime::GetSeason() const { | |
279 | 244 std::optional<Date::Month> month = info_.air_date.GetMonth(); |
245 return (month.has_value() ? GetSeasonForMonth(month.value()) : SeriesSeason::Unknown); | |
9 | 246 } |
247 | |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
248 double Anime::GetAudienceScore() const { |
9 | 249 return info_.audience_score; |
250 } | |
251 | |
252 std::string Anime::GetSynopsis() const { | |
253 return info_.synopsis; | |
254 } | |
255 | |
256 int Anime::GetDuration() const { | |
257 return info_.duration; | |
258 } | |
259 | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
260 std::string Anime::GetPosterUrl() const { |
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
261 /* this isn't really service-specific. this could use |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
262 * kitsu, MAL, or anilist, and would achieve basically |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
263 * the same effect. */ |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
264 return info_.poster_url; |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
265 } |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
266 |
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
267 std::optional<std::string> Anime::GetServiceUrl(Service service) const { |
183
01d259b9c89f
pages/torrents.cc: parse feed descriptions separately
Paper <mrpapersonic@gmail.com>
parents:
178
diff
changeset
|
268 /* todo: add support for other services... */ |
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
269 std::optional<std::string> id = GetServiceId(service); |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
270 if (!id.has_value()) |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
271 return std::nullopt; |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
272 |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
273 switch (service) { |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
274 case Service::AniList: |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
275 return "https://anilist.co/anime/" + id.value(); |
279 | 276 default: return ""; |
277 } | |
67
442065432549
poster: make posters link to AniList
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
278 } |
442065432549
poster: make posters link to AniList
Paper <mrpapersonic@gmail.com>
parents:
66
diff
changeset
|
279 |
9 | 280 void Anime::SetId(int id) { |
281 info_.id = id; | |
282 } | |
283 | |
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
284 void Anime::SetServiceId(Service service, const std::string& id) { |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
285 info_.ids[service] = id; |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
286 } |
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
284
diff
changeset
|
287 |
284
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
288 void Anime::SetTitle(TitleLanguage language, const std::string& title) { |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
289 info_.titles[language] = title; |
9 | 290 } |
291 | |
292 void Anime::SetTitleSynonyms(std::vector<std::string> const& synonyms) { | |
293 info_.synonyms = synonyms; | |
294 } | |
295 | |
296 void Anime::AddTitleSynonym(std::string const& synonym) { | |
297 info_.synonyms.push_back(synonym); | |
298 } | |
299 | |
300 void Anime::SetEpisodes(int episodes) { | |
301 info_.episodes = episodes; | |
302 } | |
303 | |
304 void Anime::SetAiringStatus(SeriesStatus status) { | |
305 info_.status = status; | |
306 } | |
307 | |
308 void Anime::SetAirDate(Date const& date) { | |
309 info_.air_date = date; | |
310 } | |
311 | |
312 void Anime::SetGenres(std::vector<std::string> const& genres) { | |
313 info_.genres = genres; | |
314 } | |
315 | |
316 void Anime::SetProducers(std::vector<std::string> const& producers) { | |
317 info_.producers = producers; | |
318 } | |
319 | |
320 void Anime::SetFormat(SeriesFormat format) { | |
321 info_.format = format; | |
322 } | |
323 | |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
305
diff
changeset
|
324 void Anime::SetAudienceScore(double audience_score) { |
9 | 325 info_.audience_score = audience_score; |
326 } | |
327 | |
328 void Anime::SetSynopsis(std::string synopsis) { | |
329 info_.synopsis = synopsis; | |
330 } | |
331 | |
332 void Anime::SetDuration(int duration) { | |
333 info_.duration = duration; | |
334 } | |
335 | |
66
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
336 void Anime::SetPosterUrl(std::string url) { |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
337 info_.poster_url = url; |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
338 } |
6481c5aed3e1
posters: add poster widget...
Paper <mrpapersonic@gmail.com>
parents:
36
diff
changeset
|
339 |
9 | 340 std::string Anime::GetUserPreferredTitle() const { |
284
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
341 std::optional<std::string> title = GetTitle(session.config.anime_list.language); |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
342 if (title.has_value()) |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
343 return title.value(); |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
344 |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
345 title = GetTitle(TitleLanguage::Romaji); |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
346 if (title.has_value()) |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
347 return title.value(); |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
348 |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
349 /* what? */ |
e66ffc338d82
anime: refactor title structure to a map
Paper <paper@paper.us.eu.org>
parents:
280
diff
changeset
|
350 return std::string(); |
9 | 351 } |
352 | |
353 } // namespace Anime |