@@ -20,11 +20,13 @@ class JSONResultParser:
2020
2121 def __init__ (self , input_game_name : str , input_game_url : str ,
2222 input_minimum_similarity : float , input_game_id : int = None ,
23- input_similarity_case_sensitive : bool = True ):
23+ input_similarity_case_sensitive : bool = True ,
24+ input_auto_filter_times : bool = False ):
2425 # Init instance variables
2526 self .results = []
2627 self .minimum_similarity = input_minimum_similarity
2728 self .similarity_case_sensitive = input_similarity_case_sensitive
29+ self .auto_filter_times = input_auto_filter_times
2830 self .game_id = input_game_id
2931 self .base_game_url = input_game_url
3032 # Init object
@@ -75,6 +77,21 @@ def parse_json_element(self, input_game_element):
7577 current_entry .completionist = round (input_game_element .get ("comp_100" ) / 3600 , 2 )
7678 if "comp_all" in input_game_element :
7779 current_entry .all_styles = round (input_game_element .get ("comp_all" ) / 3600 , 2 )
80+ if "invested_co" in input_game_element :
81+ current_entry .coop_time = round (input_game_element .get ("invested_co" ) / 3600 , 2 )
82+ if "invested_mp" in input_game_element :
83+ current_entry .mp_time = round (input_game_element .get ("invested_mp" ) / 3600 , 2 )
84+ # Add complexity booleans
85+ current_entry .complexity_lvl_combine = bool (input_game_element .get ("comp_lvl_combine" , 0 ))
86+ current_entry .complexity_lvl_sp = bool (input_game_element .get ("comp_lvl_sp" , 0 ))
87+ current_entry .complexity_lvl_co = bool (input_game_element .get ("comp_lvl_co" , 0 ))
88+ current_entry .complexity_lvl_mp = bool (input_game_element .get ("comp_lvl_mp" , 0 ))
89+ if self .auto_filter_times :
90+ # Auto-Nullify values based on the flags
91+ if current_entry .complexity_lvl_co is False :
92+ current_entry .coop_time = None
93+ if current_entry .complexity_lvl_mp is False :
94+ current_entry .mp_time = None
7895 # Compute Similarity
7996 game_name_similarity = self .similar (self .game_name , current_entry .game_name ,
8097 self .game_name_numbers , self .similarity_case_sensitive )
0 commit comments