Convert Blender-Purge to a more generic Blender-Crawl Tool #42

Merged
Nick Alberelli merged 34 commits from feature/blender-crawl into main 2023-05-17 15:38:47 +02:00
Showing only changes of commit ba0e35614d - Show all commits

View File

@ -80,14 +80,9 @@ def exception_handler(func):
f"\n# Error: {error}" f"\n# Error: {error}"
"\n# Program will be cancelled." "\n# Program will be cancelled."
) )
cancel_program sys.exit(0)
return func_wrapper return func_wrapper
def cancel_program() -> None:
print("# Exiting blender-crawl")
sys.exit(0)
def find_default_blender(): def find_default_blender():
output = subprocess.check_output(['whereis', 'blender']) output = subprocess.check_output(['whereis', 'blender'])
default_blender_str = f'/{str(output).split(" /")[1]}' default_blender_str = f'/{str(output).split(" /")[1]}'
@ -307,7 +302,7 @@ def run_blender_crawl(args: argparse.Namespace) -> int:
# Can only happen on folder here. # Can only happen on folder here.
if not files: if not files:
print("# Found no .blend files to crawl") print("# Found no .blend files to crawl")
cancel_program() sys.exit(0)
# Sort. # Sort.
files.sort(key=lambda f: f.name) files.sort(key=lambda f: f.name)
@ -315,7 +310,7 @@ def run_blender_crawl(args: argparse.Namespace) -> int:
# Prompt confirm. # Prompt confirm.
if not yes: if not yes:
if not prompt_confirm(files): if not prompt_confirm(files):
cancel_program() sys.exit(0)
# crawl each file two times. # crawl each file two times.