Mercurial > minori
diff 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 |
line wrap: on
line diff
--- a/src/gui/window.cc Fri Nov 10 13:52:47 2023 -0500 +++ b/src/gui/window.cc Sun Nov 12 04:53:19 2023 -0500 @@ -69,15 +69,22 @@ connect(timer, &QTimer::timeout, this, [this] { NowPlayingPage* page = reinterpret_cast<NowPlayingPage*>(stack->widget(static_cast<int>(Pages::NOW_PLAYING))); - std::filesystem::path path = Track::Media::GetCurrentPlaying(); - std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path); - int id = Anime::db.GetAnimeFromTitle(elements["title"]); - if (id <= 0) { - page->SetDefault(); + std::vector<std::string> files; + if (!Track::Media::GetCurrentlyPlaying(files)) return; - } - page->SetPlaying(Anime::db.items[id], elements); + /* 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"]); + if (id <= 0) + continue; + + qDebug() << id; + + page->SetPlaying(Anime::db.items[id], elements); + } }); timer->start(5000); }