diff --git a/auto_download.py b/auto_download.py index b32633d..4d73d77 100644 --- a/auto_download.py +++ b/auto_download.py @@ -3,6 +3,7 @@ import numpy as np from PIL import Image import io import base64 +import datetime from server import PromptServer class AutoDownloadNode: @@ -25,6 +26,9 @@ class AutoDownloadNode: def transmit_to_client(self, image, filename_prefix): ui_images = [] + now = datetime.datetime.now() + timestamp = now.strftime("%y_%m%d_%H%M_%S") + for index, img_tensor in enumerate(image): i = 255. * img_tensor.cpu().numpy() img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8)) @@ -36,10 +40,10 @@ class AutoDownloadNode: PromptServer.instance.send_sync("auto_download_direct", { "data": img_base64, - "filename": f"{filename_prefix}_{index:05d}.png" + "filename": f"{filename_prefix}_{timestamp}_{index:02d}.png" }) return {"ui": {"images": []}} NODE_CLASS_MAPPINGS = {"AutoDownloadNode": AutoDownloadNode} -NODE_DISPLAY_NAME_MAPPINGS = {"AutoDownloadNode": "AutoDownload2Client"} \ No newline at end of file +NODE_DISPLAY_NAME_MAPPINGS = {"AutoDownloadNode": "AutoDownload2Client"}