Browse Source
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.
refactor/sync-centralize
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.
refactor/sync-centralize
5 changed files with 113 additions and 7 deletions
-
2steps/Visualization_Start.bat
-
18steps/annex/Changelog.html
-
10steps/index.html
-
29steps/server.py
-
61steps/tests/simple_log_cfg.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() |
||||
@ -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.") |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue