comparison src/core/anime.cc @ 393:963047512d34

*: clang-format
author Paper <paper@tflc.us>
date Fri, 07 Nov 2025 07:16:15 -0500
parents 27c462bc7815
children
comparison
equal deleted inserted replaced
392:a72d6d7b3568 393:963047512d34
82 const int score = list_info_->score; 82 const int score = list_info_->score;
83 if (score == 0) 83 if (score == 0)
84 return ""; 84 return "";
85 85
86 switch (session.config.anime_list.score_format) { 86 switch (session.config.anime_list.score_format) {
87 case ScoreFormat::Point10Decimal: 87 case ScoreFormat::Point10Decimal:
88 return Strings::ToUtf8String(score / 10) + "." + Strings::ToUtf8String(score % 10); 88 return Strings::ToUtf8String(score / 10) + "." + Strings::ToUtf8String(score % 10);
89 case ScoreFormat::Point10: return Strings::ToUtf8String(score / 10); 89 case ScoreFormat::Point10:
90 case ScoreFormat::Point5: { 90 return Strings::ToUtf8String(score / 10);
91 std::string stars = ""; 91 case ScoreFormat::Point5: {
92 92 std::string stars = "";
93 for (int i = 0; i < 100; i += 20) 93
94 stars.append((i <= score) ? "★" : "☆"); 94 for (int i = 0; i < 100; i += 20)
95 95 stars.append((i <= score) ? "★" : "☆");
96 return stars; 96
97 } 97 return stars;
98 case ScoreFormat::Point3: { 98 }
99 if (score >= 100) 99 case ScoreFormat::Point3: {
100 return ":)"; 100 if (score >= 100)
101 else if (score >= 66) 101 return ":)";
102 return ":|"; 102 else if (score >= 66)
103 else if (score >= 33) 103 return ":|";
104 return ":("; 104 else if (score >= 33)
105 else 105 return ":(";
106 return ""; 106 else
107 } 107 return "";
108 default: 108 }
109 case ScoreFormat::Point100: return Strings::ToUtf8String(score); 109 default:
110 case ScoreFormat::Point100:
111 return Strings::ToUtf8String(score);
110 } 112 }
111 } 113 }
112 114
113 Date Anime::GetUserDateStarted() const 115 Date Anime::GetUserDateStarted() const
114 { 116 {
330 std::optional<std::string> id = GetServiceId(service); 332 std::optional<std::string> id = GetServiceId(service);
331 if (!id.has_value()) 333 if (!id.has_value())
332 return std::nullopt; 334 return std::nullopt;
333 335
334 switch (service) { 336 switch (service) {
335 case Service::AniList: return "https://anilist.co/anime/" + id.value(); 337 case Service::AniList:
336 default: return ""; 338 return "https://anilist.co/anime/" + id.value();
339 default:
340 return "";
337 } 341 }
338 } 342 }
339 343
340 void Anime::SetId(int id) 344 void Anime::SetId(int id)
341 { 345 {