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