From bd88d7328d3a8bb9f62747e14a71ec3f800b0c95 Mon Sep 17 00:00:00 2001 From: BrandonHalig <98606932+BrandonHalig@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:56:17 -0400 Subject: [PATCH] Confirm out_time_ms is a number In get_latest_ms_progress(), the value of out_time_ms can equal 'N/A\n', this code confirms this will not be the case in the future. Since this is only a progress indicator, it should not crash the program. --- video_creation/final_video.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 52ebe04..74abef3 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -46,8 +46,12 @@ class ProgressFfmpeg(threading.Thread): if lines: for line in lines: if "out_time_ms" in line: - out_time_ms = line.split("=")[1] - return int(out_time_ms) / 1000000.0 + out_time_ms_str = line.split("=")[1].strip() + if out_time_ms_str.isnumeric(): + return float(out_time_ms_str) / 1000000.0 + else: + # Handle the case when "N/A" is encountered + return None return None def stop(self):