Added duplicate file check
New duplicate file check prevents the queuing of duplicate files (by name/file path)
This commit is contained in:
		
							parent
							
								
									863299fe6f
								
							
						
					
					
						commit
						a7a80677f6
					
				@ -395,11 +395,15 @@ def process_video(video_filenames, main_window):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Create a function to add files to the selected files Listbox
 | 
					# Create a function to add files to the selected files Listbox
 | 
				
			||||||
def add_files():
 | 
					def add_files():
 | 
				
			||||||
 | 
					    selected_files = selected_files_listbox.get(0, tk.END)
 | 
				
			||||||
    file_paths = filedialog.askopenfilenames(filetypes=[("Video Files", "*.mp4 *.avi *.mov")])
 | 
					    file_paths = filedialog.askopenfilenames(filetypes=[("Video Files", "*.mp4 *.avi *.mov")])
 | 
				
			||||||
    if file_paths:
 | 
					    if file_paths:
 | 
				
			||||||
        for file_path in file_paths:
 | 
					        for file_path in file_paths:
 | 
				
			||||||
            selected_files_listbox.insert(tk.END, file_path)
 | 
					            if file_path not in selected_files:
 | 
				
			||||||
            debug('DEBUG', f"Queued video file: {file_path}")
 | 
					                selected_files_listbox.insert(tk.END, file_path)
 | 
				
			||||||
 | 
					                debug('DEBUG', f"Queued video file: {file_path}")
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                debug('DEBUG', f"Attempted to queue already-queued file \'{file_path}\'")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a button to remove the selected file from the Listbox
 | 
					# Create a button to remove the selected file from the Listbox
 | 
				
			||||||
def remove_file():
 | 
					def remove_file():
 | 
				
			||||||
@ -430,7 +434,7 @@ def cancel_processing():
 | 
				
			|||||||
# Create a button to process the selected files
 | 
					# Create a button to process the selected files
 | 
				
			||||||
def process_files():
 | 
					def process_files():
 | 
				
			||||||
    debug('DEBUG', f"Starting file processing ...")
 | 
					    debug('DEBUG', f"Starting file processing ...")
 | 
				
			||||||
    global processing, processing_thread
 | 
					    global processing, processing_thread, selected_files
 | 
				
			||||||
    if not processing:
 | 
					    if not processing:
 | 
				
			||||||
        processing = True
 | 
					        processing = True
 | 
				
			||||||
        selected_files = selected_files_listbox.get(0, tk.END)
 | 
					        selected_files = selected_files_listbox.get(0, tk.END)
 | 
				
			||||||
@ -444,7 +448,7 @@ def process_files():
 | 
				
			|||||||
# Define dynamic process/cancel button
 | 
					# Define dynamic process/cancel button
 | 
				
			||||||
def process_cancel_toggle():
 | 
					def process_cancel_toggle():
 | 
				
			||||||
    debug('DEBUG', f"Toggling process/cancel button state")
 | 
					    debug('DEBUG', f"Toggling process/cancel button state")
 | 
				
			||||||
    global processing, processing_thread, processing_button_state
 | 
					    global processing, processing_thread, processing_button_state, selected_files
 | 
				
			||||||
    if processing_button_state == "start":
 | 
					    if processing_button_state == "start":
 | 
				
			||||||
        if not processing:
 | 
					        if not processing:
 | 
				
			||||||
            processing = True
 | 
					            processing = True
 | 
				
			||||||
@ -632,7 +636,8 @@ label.pack(padx=20, pady=5)
 | 
				
			|||||||
# Create a Listbox to display the selected files
 | 
					# Create a Listbox to display the selected files
 | 
				
			||||||
selected_files_listbox = tk.Listbox(root, selectmode=tk.SINGLE, exportselection=0)
 | 
					selected_files_listbox = tk.Listbox(root, selectmode=tk.SINGLE, exportselection=0)
 | 
				
			||||||
selected_files_listbox.pack(fill=tk.BOTH, expand=True, padx=20, pady=5)
 | 
					selected_files_listbox.pack(fill=tk.BOTH, expand=True, padx=20, pady=5)
 | 
				
			||||||
DEBUG
 | 
					selected_files = selected_files_listbox.get(0, tk.END)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a button to select and add files to the Listbox
 | 
					# Create a button to select and add files to the Listbox
 | 
				
			||||||
select_files_button = tk.Button(root, text="Select Files", command=add_files)
 | 
					select_files_button = tk.Button(root, text="Select Files", command=add_files)
 | 
				
			||||||
select_files_button.pack(padx=20, pady=5)
 | 
					select_files_button.pack(padx=20, pady=5)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user