Skip to content

Sequential naming bug when last file is from a batch #59

@Arielif1

Description

@Arielif1

Hey, i'll preface this by saying i've never written anything in python.
However, i've found that in certain conditions when using sequential file names, the program will overwrite previously generated images.
Basically the conditions for this to happen is to have the most recent generation be from a batch operation. (eg, file names go 1, 2, 3, 4_1, 4_2)
In this situation, if the next generation is also a batch operation it will overwrite the previous batch generated images.

I've snooped around in the codebase a bit and it seems the bug originates in gallery.py, where get_next_img will, in this example, not add 4_1 nor 4_2 to the numbers array, and as such the max call will return 3, so it will set next_number as 4 and the function will return "4.png". At which point in sdcpp.py in _prepare_for_run will split it, concatenate _1 and so on to the output path, then concatenate back the extension, and overwrite the file.

I think this would be fixed if get_next_img split the filenames on either a period or an underscore instead of removing 4 chars from the end of the array, but i'm also not entirely sure, and as i said, i know precisely 0 python. Thanks for the patience lol

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions