diff src/core/config.cc @ 149:e41505d24733

players: filter out web browsers, they aren't even supported in animia yet
author Paper <mrpapersonic@gmail.com>
date Tue, 14 Nov 2023 13:40:11 -0500
parents 6fdf0632c003
children ffa535b6d630
line wrap: on
line diff
--- 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<bool>(ini, "Recognition/Players", player.second.name, true);
+	for (auto& [enabled, player] : recognition.players) {
+		switch (player.type) {
+			default:
+			case animia::PlayerType::Default:
+				enabled = INI::GetIniValue<bool>(ini, "Recognition/Players", player.name, true);
+				break;
+			case animia::PlayerType::WebBrowser:
+				enabled = INI::GetIniValue<bool>(ini, "Recognition/Browsers", player.name, true);
+				break;
+		}
+	}
 
 	/* ew */
 	locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(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);