From 0e3570af9a061776604180422ab9f1c1269ce374 Mon Sep 17 00:00:00 2001 From: Elias Bachaalany Date: Wed, 27 Dec 2023 15:57:54 -0800 Subject: [PATCH] Update idxtool.py fixed rename count --- .scripts/idxtool.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.scripts/idxtool.py b/.scripts/idxtool.py index cea6865..84d9b61 100755 --- a/.scripts/idxtool.py +++ b/.scripts/idxtool.py @@ -21,8 +21,7 @@ def get_toc_file() -> str: return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', TOC_FILENAME)) def rename_gpts(): - nb_ok = nb_total = 0 - all_renamed_already = True + effective_rename = nb_ok = nb_total = 0 for ok, gpt in enum_gpts(): nb_total += 1 @@ -34,7 +33,7 @@ def rename_gpts(): if basename.startswith(f"{id.id}_"): nb_ok += 1 continue - all_renamed_already = False + effective_rename += 1 # New full file name with ID prefix new_fn = os.path.join(os.path.dirname(gpt.filename), f"{id.id}_{basename}") @@ -53,7 +52,7 @@ def rename_gpts(): msg = f"Renamed {nb_ok} out of {nb_total} GPT files." ok = nb_ok == nb_total - if all_renamed_already: + if effective_rename == 0: msg = f"All {nb_total} GPT files were already renamed. No action taken." print(msg)