From 78d6aef30249530d8cc0b5023b2f8bf8c86f8446 Mon Sep 17 00:00:00 2001 From: tateisu Date: Mon, 26 Sep 2022 15:44:52 +0900 Subject: [PATCH] use strftime. update hints.js --- javascript/hints.js | 4 ++-- modules/images.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/javascript/hints.js b/javascript/hints.js index ed79796f..59dd770c 100644 --- a/javascript/hints.js +++ b/javascript/hints.js @@ -57,8 +57,8 @@ titles = { "Interrogate": "Reconstruct prompt from existing image and put it into the prompt field.", - "Images filename pattern": "Use following tags to define how filenames for images are chosen: [steps], [cfg], [prompt], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [prompt_words], [date], [job_timestamp]; leave empty for default.", - "Directory name pattern": "Use following tags to define how subdirectories for images and grids are chosen: [steps], [cfg], [prompt], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [prompt_words], [date], [job_timestamp]; leave empty for default.", + "Images filename pattern": "Use following tags to define how filenames for images are chosen: [steps], [cfg], [prompt], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [prompt_words], [date], [datetime], [job_timestamp]; leave empty for default.", + "Directory name pattern": "Use following tags to define how subdirectories for images and grids are chosen: [steps], [cfg], [prompt], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [prompt_words], [date], [datetime], [job_timestamp]; leave empty for default.", "Max prompt words": "Set the maximum number of words to be used in the [prompt_words] option; ATTENTION: If the words are too long, they may exceed the maximum length of the file path that the system can handle", "Loopback": "Process an image, use it as an input, repeat.", diff --git a/modules/images.py b/modules/images.py index 76278339..9458bf8d 100644 --- a/modules/images.py +++ b/modules/images.py @@ -295,7 +295,7 @@ def apply_filename_pattern(x, p, seed, prompt): x = x.replace("[model_hash]", shared.sd_model.sd_model_hash) x = x.replace("[date]", datetime.date.today().isoformat()) - x = x.replace("[datetime]", re.sub(r'(\.\d+|\D+)', "", datetime.datetime.now().isoformat())) + x = x.replace("[datetime]", datetime.datetime.now().strftime("%Y%m%d%H%M%S")) x = x.replace("[job_timestamp]", shared.state.job_timestamp) if cmd_opts.hide_ui_dir_config: