diff src/library/library.cc @ 223:84e0a3c4737a

library: implement menu bar buttons I also went ahead and put the links from Taiga in so I don't have to worry about it later...
author Paper <mrpapersonic@gmail.com>
date Mon, 08 Jan 2024 16:54:16 -0500
parents b9f111d84d95
children c4f03f83b252
line wrap: on
line diff
--- a/src/library/library.cc	Mon Jan 08 13:22:09 2024 -0500
+++ b/src/library/library.cc	Mon Jan 08 16:54:16 2024 -0500
@@ -9,6 +9,10 @@
 #include <unordered_map>
 #include <string>
 
+#include <iostream>
+
+namespace Library {
+
 // int = anime id, map = episode, paths
 std::unordered_map<int, std::unordered_map<int, std::string>> library;
 
@@ -21,7 +25,7 @@
 			if (!std::filesystem::is_regular_file(entry.path()))
 				continue;
 
-			const std::string basename = path.filename();
+			const std::string basename = entry.path().filename();
 
 			anitomy::Anitomy anitomy;
 			anitomy.Parse(Strings::ToWstring(basename));
@@ -34,10 +38,12 @@
 			if (id <= 0)
 				continue;
 
-			const int episode = Strings::ToInt(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)));
+			const int episode = Strings::ToInt(Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber)));
 
 			// we have an ID now!
 			library[id][episode] = entry.path();
 		}
 	}
 }
+
+}