comparison src/gui/window.cc @ 138:28842a8d0c6b

dep/animia: huge refactor (again...) but this time, it actually compiles! and it WORKS! (on win32... not sure about other platforms...) configuring players is still not supported: at some point I'll prune something up...
author Paper <mrpapersonic@gmail.com>
date Sun, 12 Nov 2023 04:53:19 -0500
parents 0a458cb26ff4
children 478f3b366199
comparison
equal deleted inserted replaced
137:69db40272acd 138:28842a8d0c6b
67 67
68 /* this is very very stinky */ 68 /* this is very very stinky */
69 connect(timer, &QTimer::timeout, this, [this] { 69 connect(timer, &QTimer::timeout, this, [this] {
70 NowPlayingPage* page = reinterpret_cast<NowPlayingPage*>(stack->widget(static_cast<int>(Pages::NOW_PLAYING))); 70 NowPlayingPage* page = reinterpret_cast<NowPlayingPage*>(stack->widget(static_cast<int>(Pages::NOW_PLAYING)));
71 71
72 std::filesystem::path path = Track::Media::GetCurrentPlaying(); 72 std::vector<std::string> files;
73 std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path); 73 if (!Track::Media::GetCurrentlyPlaying(files))
74 int id = Anime::db.GetAnimeFromTitle(elements["title"]);
75 if (id <= 0) {
76 page->SetDefault();
77 return; 74 return;
78 } 75
79 76 /* this should really be more intertwined with anitomy */
80 page->SetPlaying(Anime::db.items[id], elements); 77 for (const auto& file : files) {
78 std::filesystem::path path(file); // in the future it will not be guaranteed this is a path!
79 std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path.filename().string());
80 int id = Anime::db.GetAnimeFromTitle(elements["title"]);
81 if (id <= 0)
82 continue;
83
84 qDebug() << id;
85
86 page->SetPlaying(Anime::db.items[id], elements);
87 }
81 }); 88 });
82 timer->start(5000); 89 timer->start(5000);
83 } 90 }
84 91
85 void MainWindow::AddMainWidgets() { 92 void MainWindow::AddMainWidgets() {