lizhengwei

jira:NYJ-1540 desc: update api.py

@@ -32,11 +32,11 @@ class FootballReplayMatch: @@ -32,11 +32,11 @@ class FootballReplayMatch:
32 return None 32 return None
33 33
34 def det_goal_replay(self, replay): 34 def det_goal_replay(self, replay):
35 - return self.videoEventRecognition.video_event(replay, cache_path=self.cache_dir) 35 + return self.videoEventRecognition.video_event(replay, cache_dir=self.cache_dir)
36 36
37 37
38 def match_by_llm(self, replay, events): 38 def match_by_llm(self, replay, events):
39 - return self.videoMatchLive.match_batch(replay, events, max_parallel=2, cache_path=self.cache_dir) 39 + return self.videoMatchLive.match_batch(replay, events, max_parallel=2, cache_dir=self.cache_dir)
40 40
41 def replay_match_event(self, data): 41 def replay_match_event(self, data):
42 """ 42 """
@@ -62,6 +62,8 @@ class FootballReplayMatch: @@ -62,6 +62,8 @@ class FootballReplayMatch:
62 """ 62 """
63 task_id = data.get("id") 63 task_id = data.get("id")
64 match_id = data.get("match_id") 64 match_id = data.get("match_id")
  65 + replay_id = replay_info.get('id')
  66 + matched_event_id = None
65 67
66 # 该时间段附近是否有进球事件 68 # 该时间段附近是否有进球事件
67 replay_info = data['replay'] 69 replay_info = data['replay']
@@ -78,26 +80,16 @@ class FootballReplayMatch: @@ -78,26 +80,16 @@ class FootballReplayMatch:
78 if matched_event is None: 80 if matched_event is None:
79 logger.info(f"{task_id}_LLM认为视频{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 是进球但是未能找到匹配的事件") 81 logger.info(f"{task_id}_LLM认为视频{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 是进球但是未能找到匹配的事件")
80 else: 82 else:
81 - replay_id = replay_info.get('id')  
82 matched_event_id = matched_event.get('video_id') 83 matched_event_id = matched_event.get('video_id')
83 -  
84 logger.info(f"{task_id}_LLM认为视频{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 对应的进球的事件视频是{matched_event_id}") 84 logger.info(f"{task_id}_LLM认为视频{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 对应的进球的事件视频是{matched_event_id}")
85 -  
86 - return {  
87 - "id": task_id,  
88 - "match_id": match_id,  
89 - "replay_id": replay_id,  
90 - "event_id": matched_event_id,  
91 - }  
92 else: 85 else:
93 logger.info(f"{task_id}_LLM判断{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 不是进球,无需匹配") 86 logger.info(f"{task_id}_LLM判断{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 不是进球,无需匹配")
94 else: 87 else:
95 - logger.info(f'通过时间找到匹配的事件')  
96 - replay_id = replay_info.get('id')  
97 matched_event_id = matched_event.get('id') 88 matched_event_id = matched_event.get('id')
  89 + logger.info(f"{task_id}_通过时间找到匹配认为视频{replay_info['url']}_{replay_info['start_utc']}_{replay_info['end_utc']} 对应的进球的事件视频是{matched_event_id}")
98 return { 90 return {
99 "id": task_id, 91 "id": task_id,
100 "match_id": match_id, 92 "match_id": match_id,
101 "replay_id": replay_id, 93 "replay_id": replay_id,
102 - "event_id": matched_event_id, 94 + "event_id": matched_event_id
103 } 95 }