Open adlerosn opened 4 years ago
I have the same issue. Would be great to see this implemented.
I could make it work by adding this in the config (trimming the name):
"filename" : {
"" : "{title[:40]}_{subreddit}_{id}.{extension}"
},
This should be a feature. The following works for youtube-dl for example (though couldn't find it in docs):
%(title).150s
: Truncates to 150 symbols.%(title).150B
: Truncates to 150 bytes.{filename[:150]}
works in gallery-dl so I can't imagine why something like {filename[:150B]}
should not work.
There is this explanation in https://github.com/mikf/gallery-dl/issues/873#issuecomment-656366953
There is no good general solution for the "filename length problem", which is why I haven't really tried to implement something.
But we have the [:150]
symbol limiter regardless, which is not a general solution.
Looks like Linux is far from getting support for longer filenames. So for now software itself should take care of it.
Example | Result | |
---|---|---|
Slicing (Bytes) | {title_ja[b3:18]} |
γγΌγ»γ―γΌ |
Oh, thanks. Also found it here https://github.com/mikf/gallery-dl/discussions/4087#discussioncomment-5977221
It's probably safe to close this issue.
The downloaded file name should never be longer than 255 bytes under Linux.
Take the terminal output below as example:
Its file name is 247 characters long, which seems acceptable, but is 359 bytes long, which is deemed too long by the kernel (on BTRFS).
A quick workaround fix I did was through a PostProcessor:
That uses this wrapper:
That uses this function:
It would be nice if MAX_PATH was also observed (4096 on Linux, 260 on Windows (up to Windows 10's 2016 update, but only if you changed an entry in registry)), but that's not an issue for me right now.