mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
in output directory, new image files always start with the number higher than the previous maximum filename to ensure alphabetic sort==chronological sort
This commit is contained in:
parent
ca8a799373
commit
dc788f92b3
@ -449,12 +449,12 @@ The vast majority of these arguments default to reasonable values.
|
|||||||
revision = 1
|
revision = 1
|
||||||
|
|
||||||
if previousname is None:
|
if previousname is None:
|
||||||
# count up until we find an unfilled slot
|
# sort reverse alphabetically until we find max+1
|
||||||
dir_list = [a.split('.',1)[0] for a in os.listdir(outdir)]
|
dirlist = sorted(os.listdir(outdir),reverse=True)
|
||||||
uniques = dict.fromkeys(dir_list,True)
|
# find the first filename that matches our pattern or return 000000.0.png
|
||||||
basecount = 1
|
filename = next((f for f in dirlist if re.match('^(\d+)\..*\.png',f)),'0000000.0.png')
|
||||||
while f'{basecount:06}' in uniques:
|
basecount = int(filename.split('.',1)[0])
|
||||||
basecount += 1
|
basecount += 1
|
||||||
if grid_count is not None:
|
if grid_count is not None:
|
||||||
grid_label = f'grid#1-{grid_count}'
|
grid_label = f'grid#1-{grid_count}'
|
||||||
filename = f'{basecount:06}.{seed}.{grid_label}.png'
|
filename = f'{basecount:06}.{seed}.{grid_label}.png'
|
||||||
|
Loading…
Reference in New Issue
Block a user