comparison 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
comparison
equal deleted inserted replaced
153:bd439dd6ffc5 154:d43d68408d3c
15 #include "gui/pages/torrents.h" 15 #include "gui/pages/torrents.h"
16 #include "gui/widgets/sidebar.h" 16 #include "gui/widgets/sidebar.h"
17 #include "services/services.h" 17 #include "services/services.h"
18 #include "track/media.h" 18 #include "track/media.h"
19 19
20 #include "anitomy/anitomy.h"
21
20 #include <QActionGroup> 22 #include <QActionGroup>
21 #include <QApplication> 23 #include <QApplication>
22 #include <QDebug> 24 #include <QDebug>
23 #include <QFile> 25 #include <QFile>
24 #include <QHBoxLayout> 26 #include <QHBoxLayout>
74 std::vector<std::string> files; 76 std::vector<std::string> files;
75 Track::Media::GetCurrentlyPlaying(files); 77 Track::Media::GetCurrentlyPlaying(files);
76 78
77 /* this should really be more intertwined with anitomy */ 79 /* this should really be more intertwined with anitomy */
78 for (const auto& file : files) { 80 for (const auto& file : files) {
79 std::filesystem::path path(file); // in the future it will not be guaranteed this is a path! 81 anitomy::Anitomy anitomy;
80 std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path.filename().string()); 82 anitomy.Parse(Strings::ToWstring(file));
81 int id = Anime::db.GetAnimeFromTitle(elements["title"]); 83
84 const auto& elements = anitomy.elements();
85
86 int id = Anime::db.GetAnimeFromTitle(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)));
82 if (id <= 0) 87 if (id <= 0)
83 continue; 88 continue;
84 89
85 qDebug() << id; 90 qDebug() << id;
86 91