From 3d53a6d21567b2e6c5357f52200c5a7d3d944295 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 1 Jul 2023 15:06:13 +0800 Subject: [PATCH] CI: auto update plugin size --- update_list.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/update_list.py b/update_list.py index c70b014..c4e2ba3 100644 --- a/update_list.py +++ b/update_list.py @@ -13,7 +13,7 @@ for file in main["files"]: exit() if "/main.py" in file["filename"]: plugins.append(file["filename"].split("/")[0]) -delete = bool(main['commit']['message'].startswith("Delete:")) +delete = bool(main['commit']['message'].startswith("Delete")) with open("list.json", "r", encoding="utf8") as f: list_json = json.load(f) @@ -23,9 +23,8 @@ for plugin in plugins: if plug_dict["name"] == plugin: exist = True old_version = decimal.Decimal(plug_dict["version"]) - list_json["list"][list_json["list"].index(plug_dict)]["version"] = str( - old_version + decimal.Decimal("0.01") - ) + plug_dict["version"] = old_version + decimal.Decimal("0.01") + plug_dict["size"] = f"{os.path.getsize(f'{plugin}{os.sep}main.py') / 1000} kb" if delete: list_json["list"].remove(plug_dict) break