diff src/core/config.cc @ 185:62e336597bb7

anime list: add support for different score formats
author Paper <mrpapersonic@gmail.com>
date Tue, 05 Dec 2023 13:45:23 -0500
parents 01d259b9c89f
children bc1ae1810855
line wrap: on
line diff
--- a/src/core/config.cc	Mon Dec 04 13:44:42 2023 -0500
+++ b/src/core/config.cc	Tue Dec 05 13:45:23 2023 -0500
@@ -35,6 +35,7 @@
 
 	service = Translate::ToService(INI::GetIniValue<std::string>(ini, "General", "Service", "None"));
 
+	anime_list.score_format = Translate::ToScoreFormat(INI::GetIniValue<std::string>(ini, "Anime List", "Score format", "POINT_100"));
 	anime_list.language = Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji"));
 	anime_list.display_aired_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only aired episodes", true);
 	anime_list.display_available_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true);
@@ -68,9 +69,8 @@
 			return false;
 
 		recognition.players.reserve(players.size());
-		for (const auto& player : players) {
+		for (const auto& player : players)
 			recognition.players.push_back({true, player});
-		}
 	}
 
 	for (auto& [enabled, player] : recognition.players) {
@@ -103,6 +103,7 @@
 	INI::SetIniValue(ini, "General", "Service", service);
 	INI::SetIniValue(ini, "General", "Locale", locale.GetLocale().name());
 
+	INI::SetIniValue(ini, "Anime List", "Score format", Translate::ToString(anime_list.score_format));
 	INI::SetIniValue(ini, "Anime List", "Title language", anime_list.language);
 	INI::SetIniValue(ini, "Anime List", "Display only aired episodes", anime_list.display_aired_episodes);
 	INI::SetIniValue(ini, "Anime List", "Display only available episodes in library", anime_list.display_available_episodes);