From 2b53a589a7b2668f8735fbf02d6e786835e1f8df Mon Sep 17 00:00:00 2001 From: rakadu1 Date: Fri, 20 Mar 2026 11:37:49 +0530 Subject: [PATCH] V3.3.0. Stable release: Implemented cache-busting server, robust filename regex, and global ESC-key modal dismiss. Added null-guards for video-only loading and log-cfg utility. --- steps/Visualization_Start.bat | 2 +- steps/annex/Changelog.html | 18 ++++++++++- steps/index.html | 10 +++--- steps/server.py | 29 +++++++++++++++++ steps/tests/simple_log_cfg.py | 61 +++++++++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 steps/server.py create mode 100644 steps/tests/simple_log_cfg.py diff --git a/steps/Visualization_Start.bat b/steps/Visualization_Start.bat index c65d72a..06fcd8c 100644 --- a/steps/Visualization_Start.bat +++ b/steps/Visualization_Start.bat @@ -22,4 +22,4 @@ echo Server is now running on http://127.0.0.1:8000 echo Press CTRL+C at any time to stop the server. :: Run the server command directly. We know 'python' works from our test. -python -m http.server 8000 \ No newline at end of file +python server.py \ No newline at end of file diff --git a/steps/annex/Changelog.html b/steps/annex/Changelog.html index 4c96fdc..3a32360 100644 --- a/steps/annex/Changelog.html +++ b/steps/annex/Changelog.html @@ -168,8 +168,24 @@ + +
+
+
+

11. Refinement & Case Resilience (v3.3.0)

+
+

Focus on universal operation, zero-cache local server, and parsing robustness.

+ +
+ -
+

10. Stability & Infrastructure

    diff --git a/steps/index.html b/steps/index.html index c344489..2e686a9 100644 --- a/steps/index.html +++ b/steps/index.html @@ -5,7 +5,7 @@ Radar and Video Visualizer - Timestamp Synchronized - + + \ No newline at end of file diff --git a/steps/server.py b/steps/server.py new file mode 100644 index 0000000..e613b75 --- /dev/null +++ b/steps/server.py @@ -0,0 +1,29 @@ +import http.server +import socketserver +import os + +PORT = 8000 + +class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): + def end_headers(self): + # Disable caching for all files + self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') + self.send_header('Pragma', 'no-cache') + self.send_header('Expires', '0') + super().end_headers() + + def log_message(self, format, *args): + # Optional: cleaner logging + super().log_message(format, *args) + +Handler = MyHTTPRequestHandler + +print(f"Starting server on http://127.0.0.1:{PORT}") +print("Cache-busting enabled: Browser will always fetch latest files.") + +with socketserver.TCPServer(("", PORT), Handler) as httpd: + try: + httpd.serve_forever() + except KeyboardInterrupt: + print("\nServer stopped.") + httpd.server_close() diff --git a/steps/tests/simple_log_cfg.py b/steps/tests/simple_log_cfg.py new file mode 100644 index 0000000..6336deb --- /dev/null +++ b/steps/tests/simple_log_cfg.py @@ -0,0 +1,61 @@ +import re +import tkinter as tk +from tkinter import filedialog +import os + +def extract_radar_config(log_file_path, output_file_path=None): + """ + Extract radar configuration commands from log file. + + Args: + log_file_path (str): Path to input log file + output_file_path (str, optional): Path to save extracted config + """ + + # Pattern to match required lines + pattern = re.compile(r'INFO\s+-\s+radar_tracker\.console_logger\s+-\s+>\s+(.*)') + + extracted_commands = [] + + with open(log_file_path, 'r') as file: + for line in file: + match = pattern.search(line) + if match: + command = match.group(1).strip() + extracted_commands.append(command) + + # Output handling + if output_file_path: + with open(output_file_path, 'w') as out_file: + for cmd in extracted_commands: + out_file.write(cmd + '\n') + print(f"[INFO] Extracted config saved to: {output_file_path}") + else: + print("\n--- Extracted Radar Config ---\n") + for cmd in extracted_commands: + print(cmd) + + return extracted_commands + + +# Example usage +if __name__ == "__main__": + # Create and hide root tkinter window + root = tk.Tk() + root.withdraw() + + # Allow user to select a .log file + log_file = filedialog.askopenfilename( + title="Select Log File", + filetypes=[("Log Files", "*.log"), ("Text Files", "*.txt"), ("All Files", "*.*")] + ) + + if log_file: + # Generate output file name (e.g., myscript.log -> myscript.cfg) + base_name = os.path.splitext(log_file)[0] + output_file = f"{base_name}.cfg" + + extract_radar_config(log_file, output_file) + print(f"[INFO] Processing complete for {log_file}") + else: + print("[INFO] No file selected.") \ No newline at end of file