diff src/gui/window.cc @ 154:d43d68408d3c

dep/animia: fix XnuFdTools also we use anitomy directly now. HG Enter commit message. Lines beginning with 'HG:' are removed.
author Paper <mrpapersonic@gmail.com>
date Wed, 15 Nov 2023 14:14:17 -0500
parents 6fdf0632c003
children 79a2a24453fa
line wrap: on
line diff
--- a/src/gui/window.cc	Wed Nov 15 13:28:18 2023 -0500
+++ b/src/gui/window.cc	Wed Nov 15 14:14:17 2023 -0500
@@ -17,6 +17,8 @@
 #include "services/services.h"
 #include "track/media.h"
 
+#include "anitomy/anitomy.h"
+
 #include <QActionGroup>
 #include <QApplication>
 #include <QDebug>
@@ -76,9 +78,12 @@
 
 		/* this should really be more intertwined with anitomy */
 		for (const auto& file : files) {
-			std::filesystem::path path(file); // in the future it will not be guaranteed this is a path!
-			std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path.filename().string());
-			int id = Anime::db.GetAnimeFromTitle(elements["title"]);
+			anitomy::Anitomy anitomy;
+			anitomy.Parse(Strings::ToWstring(file));
+
+			const auto& elements = anitomy.elements();
+
+			int id = Anime::db.GetAnimeFromTitle(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)));
 			if (id <= 0)
 				continue;