comparison 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
comparison
equal deleted inserted replaced
184:09492158bcc5 185:62e336597bb7
33 mINI::INIStructure ini; 33 mINI::INIStructure ini;
34 file.read(ini); 34 file.read(ini);
35 35
36 service = Translate::ToService(INI::GetIniValue<std::string>(ini, "General", "Service", "None")); 36 service = Translate::ToService(INI::GetIniValue<std::string>(ini, "General", "Service", "None"));
37 37
38 anime_list.score_format = Translate::ToScoreFormat(INI::GetIniValue<std::string>(ini, "Anime List", "Score format", "POINT_100"));
38 anime_list.language = Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji")); 39 anime_list.language = Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji"));
39 anime_list.display_aired_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only aired episodes", true); 40 anime_list.display_aired_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only aired episodes", true);
40 anime_list.display_available_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true); 41 anime_list.display_available_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true);
41 anime_list.highlight_anime_if_available = INI::GetIniValue<bool>(ini, "Anime List", "Highlight anime if available", true); 42 anime_list.highlight_anime_if_available = INI::GetIniValue<bool>(ini, "Anime List", "Highlight anime if available", true);
42 43
66 67
67 if (!animia::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players)) 68 if (!animia::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players))
68 return false; 69 return false;
69 70
70 recognition.players.reserve(players.size()); 71 recognition.players.reserve(players.size());
71 for (const auto& player : players) { 72 for (const auto& player : players)
72 recognition.players.push_back({true, player}); 73 recognition.players.push_back({true, player});
73 }
74 } 74 }
75 75
76 for (auto& [enabled, player] : recognition.players) { 76 for (auto& [enabled, player] : recognition.players) {
77 switch (player.type) { 77 switch (player.type) {
78 default: 78 default:
101 mINI::INIStructure ini; 101 mINI::INIStructure ini;
102 102
103 INI::SetIniValue(ini, "General", "Service", service); 103 INI::SetIniValue(ini, "General", "Service", service);
104 INI::SetIniValue(ini, "General", "Locale", locale.GetLocale().name()); 104 INI::SetIniValue(ini, "General", "Locale", locale.GetLocale().name());
105 105
106 INI::SetIniValue(ini, "Anime List", "Score format", Translate::ToString(anime_list.score_format));
106 INI::SetIniValue(ini, "Anime List", "Title language", anime_list.language); 107 INI::SetIniValue(ini, "Anime List", "Title language", anime_list.language);
107 INI::SetIniValue(ini, "Anime List", "Display only aired episodes", anime_list.display_aired_episodes); 108 INI::SetIniValue(ini, "Anime List", "Display only aired episodes", anime_list.display_aired_episodes);
108 INI::SetIniValue(ini, "Anime List", "Display only available episodes in library", anime_list.display_available_episodes); 109 INI::SetIniValue(ini, "Anime List", "Display only available episodes in library", anime_list.display_available_episodes);
109 INI::SetIniValue(ini, "Anime List", "Highlight anime if available", anime_list.highlight_anime_if_available); 110 INI::SetIniValue(ini, "Anime List", "Highlight anime if available", anime_list.highlight_anime_if_available);
110 INI::SetIniValue(ini, "Anime List", "Display highlighted anime above others", anime_list.highlighted_anime_above_others); 111 INI::SetIniValue(ini, "Anime List", "Display highlighted anime above others", anime_list.highlighted_anime_above_others);