From a5bf859193eb0352493ee0f19556249106155b27 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Sat, 9 Dec 2023 00:22:24 +0900 Subject: [PATCH] refactor --- __init__.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/__init__.py b/__init__.py index 4c5b0cd6..3e8d0807 100644 --- a/__init__.py +++ b/__init__.py @@ -493,6 +493,17 @@ def simple_hash(input_string): return hash_value +def is_file_created_within_one_day(file_path): + if not os.path.exists(file_path): + return False + + file_creation_time = os.path.getctime(file_path) + current_time = datetime.datetime.now().timestamp() + time_difference = current_time - file_creation_time + + return time_difference <= 86400 + + async def get_data_by_mode(mode, filename): try: if mode == "local": @@ -648,17 +659,6 @@ def check_custom_nodes_installed(json_obj, do_fetch=False, do_update_check=True, print(f"\x1b[2K\rUpdate check done.") -def is_file_created_within_one_day(file_path): - if not os.path.exists(file_path): - return False - - file_creation_time = os.path.getctime(file_path) - current_time = datetime.datetime.now().timestamp() - time_difference = current_time - file_creation_time - - return time_difference <= 86400 - - @server.PromptServer.instance.routes.get("/customnode/getmappings") async def fetch_customnode_mappings(request): json_obj = await get_data_by_mode(request.rel_url.query["mode"], 'extension-node-map.json')