kemono-dl
kemono-dl copied to clipboard
Add option to shorten names of files and directories if too long.
Description
One of the artists I am currently downloading has a few posts, whose filenames surpasses the limit of 255 characters. Please add an option to shorten filenames to a certain length if they are too long. I am aware of the option to change the filename template but this is not a solution for me, as this would lead to inconsistency between new and already downloaded files.
Thank you
Hi,
The windows limit not only file name length but also full path length. It's a bit tricky to make sure it won't hit the limit as the path of parent directory may hit that limit already, which means it will extremely limit the length file name.
The approach that limits file name only may not handle this well, but let me check what I can do here...
But for your question, python provide a powerful string format mini language, which may help. Please refer https://docs.python.org/3/library/string.html#formatspec
I am actually using a Linux filesystem, which has no such limit on absolute path length, every directory in a directory tree can be 255 characters long, including the files. The absolute path length is therefore of no concern, only a filename or directory name may not be longer than those 255 characters.