# HG changeset patch # User Paper # Date 1699987211 18000 # Node ID e41505d24733f8dac9bd2fbea1b933a8998a00e3 # Parent aa4df5a8433859160ceb55683f90a668df13d3fb players: filter out web browsers, they aren't even supported in animia yet diff -r aa4df5a84338 -r e41505d24733 include/core/config.h --- a/include/core/config.h Tue Nov 14 13:27:13 2023 -0500 +++ b/include/core/config.h Tue Nov 14 13:40:11 2023 -0500 @@ -44,6 +44,8 @@ struct { public: bool detect_media_players; + /* preferably web browsers would be in a separate vector, + but whatever :/ */ std::vector> players; } recognition; diff -r aa4df5a84338 -r e41505d24733 src/core/config.cc --- a/src/core/config.cc Tue Nov 14 13:27:13 2023 -0500 +++ b/src/core/config.cc Tue Nov 14 13:40:11 2023 -0500 @@ -68,8 +68,17 @@ recognition.players.push_back({true, player}); } - for (auto& player : recognition.players) - player.first = INI::GetIniValue(ini, "Recognition/Players", player.second.name, true); + for (auto& [enabled, player] : recognition.players) { + switch (player.type) { + default: + case animia::PlayerType::Default: + enabled = INI::GetIniValue(ini, "Recognition/Players", player.name, true); + break; + case animia::PlayerType::WebBrowser: + enabled = INI::GetIniValue(ini, "Recognition/Browsers", player.name, true); + break; + } + } /* ew */ locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue(ini, "General", "Locale", "en_US")))); @@ -104,8 +113,17 @@ INI::SetIniValue(ini, "Recognition", "Detect media players", recognition.detect_media_players); - for (const auto& player : recognition.players) - INI::SetIniValue(ini, "Recognition/Players", player.second.name, player.first); + for (const auto& [enabled, player] : recognition.players) { + switch (player.type) { + default: + case animia::PlayerType::Default: + INI::SetIniValue(ini, "Recognition/Players", player.name, enabled); + break; + case animia::PlayerType::WebBrowser: + INI::SetIniValue(ini, "Recognition/Browsers", player.name, enabled); + break; + } + } file.write(ini); diff -r aa4df5a84338 -r e41505d24733 src/gui/dialog/settings/recognition.cc --- a/src/gui/dialog/settings/recognition.cc Tue Nov 14 13:27:13 2023 -0500 +++ b/src/gui/dialog/settings/recognition.cc Tue Nov 14 13:40:11 2023 -0500 @@ -37,11 +37,11 @@ { QListWidget* listwidget = new QListWidget(widget); for (size_t i = 0; i < players.size(); i++) { - const auto& player = players[i]; - { + const auto& [enabled, player] = players[i]; + if (player.type == animia::PlayerType::Default) { QListWidgetItem* item = new QListWidgetItem(listwidget); - item->setCheckState(player.first ? Qt::Checked : Qt::Unchecked); - item->setText(Strings::ToQString(player.second.name)); + item->setCheckState(enabled ? Qt::Checked : Qt::Unchecked); + item->setText(Strings::ToQString(player.name)); item->setData(Qt::UserRole, QVariant::fromValue(i)); } } diff -r aa4df5a84338 -r e41505d24733 src/track/media.cc --- a/src/track/media.cc Tue Nov 14 13:27:13 2023 -0500 +++ b/src/track/media.cc Tue Nov 14 13:40:11 2023 -0500 @@ -20,7 +20,7 @@ players.reserve(session.config.recognition.players.size()); for (const auto& [enabled, player] : session.config.recognition.players) - if (enabled) + if (enabled && player.type == animia::PlayerType::Default) players.push_back(player); if (!animia::GetResults(players, results))