comparison src/core/anime_db.cc @ 260:dd211ff68b36

pages/seasons: add initial functionality the menu doesn't work yet, but it's a good start
author Paper <paper@paper.us.eu.org>
date Wed, 03 Apr 2024 19:48:38 -0400
parents 862d0d8619f6
children 9a04802848c0
comparison
equal deleted inserted replaced
259:0362f3c4534c 260:dd211ff68b36
129 int Database::GetAnimeFromTitle(const std::string& title) { 129 int Database::GetAnimeFromTitle(const std::string& title) {
130 if (title.empty()) 130 if (title.empty())
131 return 0; 131 return 0;
132 132
133 for (const auto& [id, anime] : items) { 133 for (const auto& [id, anime] : items) {
134 if (anime.GetUserPreferredTitle() == title) 134 std::vector<std::string> synonyms(anime.GetTitleSynonyms());
135 return id; 135 synonyms.push_back(anime.GetUserPreferredTitle());
136 136
137 for (const auto& synonym : anime.GetTitleSynonyms()) 137 for (const auto& synonym : synonyms) {
138 if (synonym == title) 138 if (synonym == title) {
139 return id; 139 return id;
140 }
141 }
140 } 142 }
141 143
142 return 0; 144 return 0;
143 } 145 }
144 146