diff --git a/anime_audio_encoder.py b/anime_audio_encoder.py index 5311022..94385b4 100644 --- a/anime_audio_encoder.py +++ b/anime_audio_encoder.py @@ -209,12 +209,24 @@ def is_ffmpeg_decodable(file_path): def main(no_downmix=False): check_tools() + + current_dir = Path(".") + + # Check if there are any MKV files to process before creating directories + files_to_process = sorted( + f for f in current_dir.glob("*.mkv") + if not (f.name.endswith(".ut.mkv") or f.name.startswith("temp-") or f.name.startswith("output-") or f.name.endswith(".cfr_temp.mkv")) + ) + + if not files_to_process: + print("No MKV files found to process. Exiting.") + return # Exit without creating directories + + # Only create directories when we actually have files to process DIR_COMPLETED.mkdir(exist_ok=True, parents=True) DIR_ORIGINAL.mkdir(exist_ok=True, parents=True) DIR_CONV_LOGS.mkdir(exist_ok=True, parents=True) # Create conv_logs directory - current_dir = Path(".") - while True: files_to_process = sorted( f for f in current_dir.glob("*.mkv") diff --git a/tv_audio_encoder.py b/tv_audio_encoder.py index 8acb987..65715dc 100644 --- a/tv_audio_encoder.py +++ b/tv_audio_encoder.py @@ -161,16 +161,28 @@ def convert_video(source_file_base, source_file_full): def main(no_downmix=False): check_tools() + + current_dir = Path(".") + + # Check if there are any MKV files to process before creating directories + files_to_process = sorted( + f for f in current_dir.glob("*.mkv") + if not (f.name.endswith(".ut.mkv") or f.name.startswith("temp-") or f.name.startswith("output-")) + ) + + if not files_to_process: + print("No MKV files found to process. Exiting.") + return # Exit without creating directories + + # Only create directories when we actually have files to process DIR_COMPLETED.mkdir(exist_ok=True, parents=True) DIR_ORIGINAL.mkdir(exist_ok=True, parents=True) DIR_LOGS.mkdir(exist_ok=True, parents=True) - current_dir = Path(".") - while True: files_to_process = sorted( f for f in current_dir.glob("*.mkv") - if not (f.name.endswith(".ut.mkv") or f.name.startswith("temp-") or f.name.startswith("output-") ) + if not (f.name.endswith(".ut.mkv") or f.name.startswith("temp-") or f.name.startswith("output-")) ) if not files_to_process: