Closed vt-idiot closed 2 years ago
And a gigabrain fix for my other issue:
img_path = ntpath.join(directory, str(regex_result_cnt) + "-" + get_valid_filename(img))
Thanks a lot for contributing! I'm a little confused by how you said that you have no idea of how to fix the issue, but you showed two fixes for something! If you want me to include these snippets of code in the program it should be pretty easy.
I was going to open a PR myself, but didn't because the first solution isn't quite what I'd hoped. It's a little bit too aggressive with the filenames. The second one works great though. Happily running it locally now with both changes plus all os.path
's changed to ntpath
. And the block of code that runs the downloaded/new folder copy tossed out.
Oh, and there's definitely a way to properly parse Spoiler_Image
filenames since 4chanx and archive sites seem to do it, but I wouldn't know where to start for that one.
I added your call of get_valid_filename
to the script and added the issue of duplicate filenames as a TODO to the README.
I've run into a few issues with filenames. One of them isn't entirely Windows specific, and I have an idea of what needs to be done to fix it, but no idea how to. Duplicate filenames within a thread simply overwrite any preceding files. Usually
Spoiler_Image
orfile.png
.The other issue is Windows specific and I've managed to solve it at least locally by:
The issue in question, filenames like this used to make the script halt on Windows:
After importing it appears to work.