fixes global busy ignore
This commit is contained in:
@@ -16,6 +16,8 @@ video_extensions: list[str] = ["mp4", "mkv", "avi", "wmv", "mov", "m4v", "ts", "
|
|||||||
|
|
||||||
total_files: int = 0
|
total_files: int = 0
|
||||||
|
|
||||||
|
ignore_busy = False
|
||||||
|
|
||||||
def is_system_busy() -> bool:
|
def is_system_busy() -> bool:
|
||||||
"""Returns true if the cpu is doing something else. maybe."""
|
"""Returns true if the cpu is doing something else. maybe."""
|
||||||
# First call all processes, so we can recheck them later.
|
# 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='):
|
if line and line.startswith('out_time_ms='):
|
||||||
try:
|
try:
|
||||||
if time.time() - last_update > UPDATE_INTERVAL:
|
if time.time() - last_update > UPDATE_INTERVAL:
|
||||||
if is_system_busy():
|
if not ignore_busy and is_system_busy():
|
||||||
if pbar:
|
if pbar:
|
||||||
pbar.close()
|
pbar.close()
|
||||||
return False
|
return False
|
||||||
@@ -347,6 +349,9 @@ def main():
|
|||||||
logging.error("System is busy, try again later or use --ignore-busy flag to override")
|
logging.error("System is busy, try again later or use --ignore-busy flag to override")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
global ignore_busy
|
||||||
|
ignore_busy = bool(args.ignore_busy)
|
||||||
|
|
||||||
logging.info(f"Starting video compression from {source_dir} to {destination_dir}")
|
logging.info(f"Starting video compression from {source_dir} to {destination_dir}")
|
||||||
|
|
||||||
global total_files
|
global total_files
|
||||||
|
|||||||
Reference in New Issue
Block a user