From 06c2fb63afdf119bd0cb4fa8a61a6561a81f8795 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Mon, 3 Feb 2025 12:18:55 +0100 Subject: [PATCH] fixes global busy ignore --- bin/vcmp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/vcmp b/bin/vcmp index 972b827..f968f97 100755 --- a/bin/vcmp +++ b/bin/vcmp @@ -16,6 +16,8 @@ video_extensions: list[str] = ["mp4", "mkv", "avi", "wmv", "mov", "m4v", "ts", " total_files: int = 0 +ignore_busy = False + def is_system_busy() -> bool: """Returns true if the cpu is doing something else. maybe.""" # First call all processes, so we can recheck them later. @@ -160,7 +162,7 @@ def run_progress(process, duration, file_index=0) -> bool: if line and line.startswith('out_time_ms='): try: if time.time() - last_update > UPDATE_INTERVAL: - if is_system_busy(): + if not ignore_busy and is_system_busy(): if pbar: pbar.close() return False @@ -347,6 +349,9 @@ def main(): logging.error("System is busy, try again later or use --ignore-busy flag to override") sys.exit(1) + global ignore_busy + ignore_busy = bool(args.ignore_busy) + logging.info(f"Starting video compression from {source_dir} to {destination_dir}") global total_files