From d357aaac80a69209c5b8d01e9799d7742de84c86 Mon Sep 17 00:00:00 2001 From: pat-e Date: Thu, 17 Jul 2025 12:05:21 +0200 Subject: [PATCH] updated logic about folder creation --- MkvOpusEnc.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/MkvOpusEnc.py b/MkvOpusEnc.py index 9e0991f..9b0a24f 100644 --- a/MkvOpusEnc.py +++ b/MkvOpusEnc.py @@ -106,15 +106,29 @@ def main(): check_tools() + # Define directory paths but don't create them yet DIR_COMPLETED = Path("completed") DIR_ORIGINAL = Path("original") DIR_LOGS = Path("conv_logs") + current_dir = Path(".") + + # Check if there are any MKV files to process + files_to_process = sorted( + f for f in current_dir.glob("*.mkv") + if not f.name.startswith("temp-output-") + ) + + if not files_to_process: + print("No MKV files found to process. Exiting.") + return # Exit without creating directories + + # Create directories only when we actually have files to process DIR_COMPLETED.mkdir(exist_ok=True) DIR_ORIGINAL.mkdir(exist_ok=True) DIR_LOGS.mkdir(exist_ok=True) - current_dir = Path(".") while True: + # Re-check for files in case new ones were added files_to_process = sorted( f for f in current_dir.glob("*.mkv") if not f.name.startswith("temp-output-")