Mercurial > minori
comparison src/library/library.cc @ 228:d030b30526d5
config: remove unused username parameter from anilist auth
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Tue, 09 Jan 2024 08:05:36 -0500 |
| parents | c4f03f83b252 |
| children | 862d0d8619f6 |
comparison
equal
deleted
inserted
replaced
| 227:c4f03f83b252 | 228:d030b30526d5 |
|---|---|
| 17 std::unordered_map<int, std::unordered_map<int, std::string>> library; | 17 std::unordered_map<int, std::unordered_map<int, std::string>> library; |
| 18 | 18 |
| 19 void SearchLibraryFolders() { | 19 void SearchLibraryFolders() { |
| 20 library.clear(); | 20 library.clear(); |
| 21 | 21 |
| 22 for (const auto& spath : session.config.library.paths) { | 22 for (const auto& folder : session.config.library.paths) { |
| 23 const std::filesystem::path path(spath); | 23 for (const auto& entry : std::filesystem::recursive_directory_iterator(folder)) { |
| 24 for (const auto& entry : std::filesystem::recursive_directory_iterator(path)) { | 24 const std::filesystem::path path = entry.path(); |
| 25 if (!std::filesystem::is_regular_file(entry.path())) | 25 if (!std::filesystem::is_regular_file(path)) |
| 26 continue; | 26 continue; |
| 27 | 27 |
| 28 const std::string basename = entry.path().filename().string(); | 28 const std::string basename = path.filename().u8string(); |
| 29 | 29 |
| 30 anitomy::Anitomy anitomy; | 30 anitomy::Anitomy anitomy; |
| 31 anitomy.Parse(Strings::ToWstring(basename)); | 31 anitomy.Parse(Strings::ToWstring(basename)); |
| 32 | 32 |
| 33 const auto& elements = anitomy.elements(); | 33 const auto& elements = anitomy.elements(); |
| 39 continue; | 39 continue; |
| 40 | 40 |
| 41 const int episode = Strings::ToInt(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber))); | 41 const int episode = Strings::ToInt(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber))); |
| 42 | 42 |
| 43 // we have an ID now! | 43 // we have an ID now! |
| 44 library[id][episode] = entry.path(); | 44 library[id][episode] = path.u8string(); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 } | 49 } |
