from datetime import datetime, timedelta

from AW.DatabaseAW import Executor

def main():
    db = Executor(db_path="/Users/HuangJun/00_AutoTestHJ/SiameseNetwork/demo/Screenrecorder-2025-05-21-15-06-07-716.mp4.db")
    total_db = Executor(db_path="/Users/HuangJun/00_AutoTestHJ/SiameseNetwork/demo/Total.db")

    summary = db.select(table_name="SmoothedTestSummary", columns=["start_frame", "end_frame"], condition="label=1")
    video_start_time = datetime.strptime("15:06:08.000", "%H:%M:%S.%f")
    for start_frame, end_frame in summary:
        start_time = (video_start_time + timedelta(seconds=start_frame)).strftime("%H:%M:%S.%f")[:-3]
        end_time = (video_start_time + timedelta(seconds=end_frame)).strftime("%H:%M:%S.%f")[:-3]
        data = {"Devices": "REF", "Method":"AI", "StartTime": start_time, "EndTime": end_time}
        total_db.insert(table_name="Result", data=data)

def main2():
    total_db = Executor(db_path="/Users/HuangJun/00_AutoTestHJ/SiameseNetwork/demo/Total.db")

if __name__ == '__main__':
    main()
