From 4af41ffce6e92d3d75d498ad53de56c9969cdbb8 Mon Sep 17 00:00:00 2001 From: David <49467229+TheSecurityDev@users.noreply.github.com> Date: Sat, 14 Feb 2026 15:20:44 -0600 Subject: [PATCH] ui diff: ensure video name matches output (#37211) * auto name diff.mp4 * ensure output file has .html extension --- selfdrive/ui/tests/diff/diff.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/tests/diff/diff.py b/selfdrive/ui/tests/diff/diff.py index a581f6874..bde6d4423 100755 --- a/selfdrive/ui/tests/diff/diff.py +++ b/selfdrive/ui/tests/diff/diff.py @@ -62,7 +62,7 @@ def find_differences(video1, video2): return different_frames, len(frames1) -def generate_html_report(video1, video2, basedir, different_frames, total_frames): +def generate_html_report(video1, video2, basedir, different_frames, total_frames, diff_video_name): chunks = [] if different_frames: current_chunk = [different_frames[0]] @@ -100,7 +100,7 @@ def generate_html_report(video1, video2, basedir, different_frames, total_frames

Pixel Diff

@@ -152,6 +152,9 @@ def main(): args = parser.parse_args() + if not args.output.lower().endswith('.html'): + args.output += '.html' + os.makedirs(DIFF_OUT_DIR, exist_ok=True) print("=" * 60) @@ -162,8 +165,9 @@ def main(): print(f"Output: {args.output}") print() - # Create diff video - diff_video_path = os.path.join(os.path.dirname(args.output), DIFF_OUT_DIR / "diff.mp4") + # Create diff video with name derived from output HTML + diff_video_name = Path(args.output).stem + '.mp4' + diff_video_path = str(DIFF_OUT_DIR / diff_video_name) create_diff_video(args.video1, args.video2, diff_video_path) different_frames, total_frames = find_differences(args.video1, args.video2) @@ -173,7 +177,7 @@ def main(): print() print("Generating HTML report...") - html = generate_html_report(args.video1, args.video2, args.basedir, different_frames, total_frames) + html = generate_html_report(args.video1, args.video2, args.basedir, different_frames, total_frames, diff_video_name) with open(DIFF_OUT_DIR / args.output, 'w') as f: f.write(html)