From 58d6f1ff58aae216aeb63afd8adf8c23d28ba852 Mon Sep 17 00:00:00 2001 From: Falko Habel Date: Thu, 28 Mar 2024 21:04:50 +0100 Subject: [PATCH] [BUG] #002 added Error Message to Converter --- scripts/Converter.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/Converter.py b/scripts/Converter.py index 10ee773..6e0cfea 100644 --- a/scripts/Converter.py +++ b/scripts/Converter.py @@ -2,7 +2,9 @@ import customtkinter as Ctk from tkinter import filedialog import scripts.get_sys_info as system_code import cv2 +import os import threading +from pathlib import Path EPSILON = 1e-9 # choose an appropriate epsilon value @@ -60,8 +62,6 @@ class WorkerThread(threading.Thread): video.release() - - class Converter(Ctk.CTkFrame): def __init__(self,master, **kwargs): super().__init__(master, **kwargs) @@ -203,11 +203,21 @@ class Converter(Ctk.CTkFrame): self.output_entry.insert(0, file_path) # Insert the new text def start_threads(self): + self.input_path = self.input_entry.get() + self.output_path = self.output_entry.get() + + input_extension = Path(self.input_path).suffix.lower() + if input_extension not in ['.mp4', '.avi', '.mkv', '.mov']: + self.progress_info.configure(text="Source Video could not be found") + return + + if not os.path.exists(self.output_path): + self.progress_info.configure(text="Output Folder could not be found!") + return self.input_btn.configure(state="disabled") self.output_btn.configure(state="disabled") self.start_btn.configure(state="disabled") - self.input_path = self.input_entry.get() - self.output_path = self.output_entry.get() + self.img_name = self.img_naming.get() self.total_frames = self.get_frame_rate_and_last_frame(self.input_path) self.step_size = 1 / self.total_frames * 100 /2