Mercurial > minori
comparison src/track/media.cc @ 147:6fdf0632c003
track: use a bit of a more sane way to manage recognition
it also works with the new animia API
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Tue, 14 Nov 2023 13:19:40 -0500 |
| parents | 478f3b366199 |
| children | e41505d24733 |
comparison
equal
deleted
inserted
replaced
| 146:d8a61e7e2a36 | 147:6fdf0632c003 |
|---|---|
| 16 namespace Media { | 16 namespace Media { |
| 17 | 17 |
| 18 static bool GetCurrentlyPlayingResults(std::vector<animia::Result>& results) { | 18 static bool GetCurrentlyPlayingResults(std::vector<animia::Result>& results) { |
| 19 std::vector<animia::Player> players; | 19 std::vector<animia::Player> players; |
| 20 | 20 |
| 21 { | 21 players.reserve(session.config.recognition.players.size()); |
| 22 QFile f(":/players.anisthesia"); | 22 for (const auto& [enabled, player] : session.config.recognition.players) |
| 23 if (!f.exists()) | 23 if (enabled) |
| 24 return false; | 24 players.push_back(player); |
| 25 | |
| 26 f.open(QFile::ReadOnly | QFile::Text); | |
| 27 QTextStream ts(&f); | |
| 28 | |
| 29 if (!animia::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players)) | |
| 30 return false; | |
| 31 } | |
| 32 | 25 |
| 33 if (!animia::GetResults(players, results)) | 26 if (!animia::GetResults(players, results)) |
| 34 return false; | 27 return false; |
| 35 | 28 |
| 36 return true; | 29 return true; |
