Implement new match video flow with betting calculation

- Remove automatic PLAY_VIDEO_MATCH sending from MatchTimerComponent
- Add MATCH_START handler to GamesThread with betting calculation logic
- Update Message Builder to include result parameter in PLAY_VIDEO_MATCH messages
- Update Qt Player to use match_video.html template for match videos
- Add new match_video.html overlay template for displaying match results

The new flow: Start Games -> MATCH_START -> betting calculation -> PLAY_VIDEO_MATCH with result -> display match video with result overlay
parent 01b4e509
This diff is collapsed.
......@@ -619,16 +619,19 @@ class MessageBuilder:
)
@staticmethod
def play_video_match(sender: str, match_id: int, video_filename: str, fixture_id: Optional[str] = None) -> Message:
def play_video_match(sender: str, match_id: int, video_filename: str, fixture_id: Optional[str] = None, result: str = None) -> Message:
"""Create PLAY_VIDEO_MATCH message"""
data = {
"match_id": match_id,
"video_filename": video_filename,
"fixture_id": fixture_id
}
if result is not None:
data["result"] = result
return Message(
type=MessageType.PLAY_VIDEO_MATCH,
sender=sender,
data={
"match_id": match_id,
"video_filename": video_filename,
"fixture_id": fixture_id
}
data=data
)
@staticmethod
......
......@@ -2871,11 +2871,22 @@ class QtVideoPlayer(QObject):
match_id = message.data.get("match_id")
video_filename = message.data.get("video_filename")
fixture_id = message.data.get("fixture_id")
result = message.data.get("result") # Extract result parameter
if not match_id or not video_filename:
logger.error("Missing match_id or video_filename in PLAY_VIDEO_MATCH message")
return
# Use result to determine video filename if not provided or to validate
if result:
expected_filename = f"{result}.mp4"
if video_filename != expected_filename:
logger.warning(f"Video filename mismatch: expected {expected_filename}, got {video_filename}")
video_filename = expected_filename # Override with result-based filename
logger.info(f"Match result: {result}, using video: {video_filename}")
else:
logger.warning("No result provided in PLAY_VIDEO_MATCH message")
# Stop the current intro video loop and template rotation
if self.window and hasattr(self.window, 'media_player'):
logger.info("Stopping intro video loop and template rotation")
......@@ -2906,13 +2917,20 @@ class QtVideoPlayer(QObject):
# Play the match video (no looping)
if self.window:
# Update overlay with result information
overlay_data = {
"title": f"Match {match_id}",
"subtitle": f"Result: {result}" if result else "Live Action",
"result": result
}
self.window.play_video(
str(match_video_path),
template_data={"title": f"Match {match_id}", "subtitle": "Live Action"},
template_name="news_template",
template_data=overlay_data,
template_name="match_video.html",
loop_data=None # No looping for match videos
)
logger.info(f"Match video started: {video_filename}")
logger.info(f"Match video started: {video_filename} with result: {result}")
else:
logger.error("No window available for match video playback")
else:
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment