11import os
22from datetime import datetime , timedelta
3- from objects .match import Match
3+ from log_analyser . objects .map import Map
44
55
66class LogAnalyser :
@@ -12,9 +12,9 @@ def __init__(self, path_csv, name) -> None:
1212
1313 self .date = self .name2datetime ()
1414
15- self .match = None
15+ self .map = None
1616
17- self .actions = {"match_start" : self .process_match_start }
17+ self .actions = {"match_start" : self .process_map_start }
1818
1919 def run (self ):
2020
@@ -29,8 +29,8 @@ def run(self):
2929 if type in self .actions :
3030 self .actions [type ](line_split )
3131
32- with open ("../logs_process/{}.json" .format (self .name .split ("." )[0 ]), "w" ) as file :
33- file .write (self .match .export_json ())
32+ # with open("../logs_process/{}.json".format(self.name.split(".")[0]), "w") as file:
33+ # file.write(self.map .export_json())
3434
3535
3636 def name2datetime (self ):
@@ -40,9 +40,9 @@ def name2datetime(self):
4040
4141 return date_object
4242
43- def process_match_start (self , data ):
43+ def process_map_start (self , data ):
4444
45- self .match = Match .from_json ({"rounds" : [],
45+ self .map = Map .from_json ({"rounds" : [],
4646 "date" : self .date ,
4747 "map_name" : data [3 ],
4848 "map_type" : data [4 ],
@@ -52,30 +52,30 @@ def process_match_start(self, data):
5252 "score_team2" : 0 ,
5353 })
5454
55- self .actions = {"match_start" : self .process_match_start ,
56- "round_start" : self .match .add_round ,
57- "round_end" : self .match .end_round ,
55+ self .actions = {"match_start" : self .process_map_start ,
56+ "round_start" : self .map .add_round ,
57+ "round_end" : self .map .end_round ,
5858 "hero_spawn" : self .process_hero_spawn ,
5959 "hero_swap" : self .process_hero_swap ,
60- "kill" : self .match .add_kill ,
61- "ultimate_charged" : self .match .add_ultimate_charged ,
62- "ultimate_start" : self .match .add_ultimate_start ,
63- "ultimate_end" : self .match .add_ultimate_end ,
64- "objective_captured" : self .match .add_objective_captured ,
65- "player_stat" : self .match .add_player_stat ,
66- "point_progress" : self .match .add_objective_progress ,
67- "payload_progress" : self .match .add_objective_progress ,
60+ "kill" : self .map .add_kill ,
61+ "ultimate_charged" : self .map .add_ultimate_charged ,
62+ "ultimate_start" : self .map .add_ultimate_start ,
63+ "ultimate_end" : self .map .add_ultimate_end ,
64+ "objective_captured" : self .map .add_objective_captured ,
65+ "player_stat" : self .map .add_player_stat ,
66+ "point_progress" : self .map .add_objective_progress ,
67+ "payload_progress" : self .map .add_objective_progress ,
6868 }
6969
7070 def process_hero_spawn (self , data ):
7171
7272 player_data = {"time" : data [2 ], "team_name" : data [3 ], "player_name" : data [4 ], "character_name" : data [5 ]}
73- self .match .add_player (player_data )
73+ self .map .add_player (player_data )
7474
7575 def process_hero_swap (self , data ):
7676
7777 hero_data = {"time" : data [2 ], "team_name" : data [3 ], "player_name" : data [4 ], "character_name" : data [5 ], "character_swap" : data [6 ]}
78- self .match .add_hero_swap (hero_data )
78+ self .map .add_hero_swap (hero_data )
7979
8080 def convert_timefile_to_datetime (self , time_string ):
8181
@@ -87,11 +87,11 @@ def convert_timefile_to_datetime(self, time_string):
8787 return duration
8888
8989
90- for file in os .listdir ("../logs" ):
91- if file .endswith (".txt" ):
92- print (file )
93- la = LogAnalyser ('../logs/{}' .format (file ), file )
94- la .run ()
90+ # for file in os.listdir("../logs"):
91+ # if file.endswith(".txt"):
92+ # print(file)
93+ # la = LogAnalyser('../logs/{}'.format(file), file)
94+ # la.run()
9595
9696# la = LogAnalyser('../logs/Log-2023-12-22-21-12-32.txt', "Log-2023-12-22-21-12-32.txt")
9797# la.run()
0 commit comments