You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree that the Try.Me.Bug - 07 - One.Two.5.[text].mkv case was a bug (at least undesired behavior) and I have a fix proposed in #146.
However, the TryMe_-_01_-_One_Two_Three_[text].mkv case is not a bug, and you would need to use something like key=lambda x: x.replace("_", " ") to sort it properly. This is because the code has no way to tell that you want to treat "_" and " " the same unless you tell it to.
Describe the bug
It can happen that the
os_sorted
functionality does not sort correctly files with special character insideExpected behavior
File sorting equal to Windows Explorer
Environment (please complete the following information):
LOCALE
orhumansorted
:PyICU
installed? NoTo Reproduce
Expected sorting:
file_list
Try.Me.Bug - 07 - One.Two.5.[text].mkv
Try.Me.Bug - 08 - One.Two.Three[text].mkv
Try.Me.Bug - 09 - One.Two.Three.[text].mkv
file_list2
TryMe_-_01_-_One_Two_Three_[text].mkv
TryMe - 02 - One Two Three [text].mkv
TryMe_-_03_-_One_Two_Three_[text].mkv
Actual sorting
file_list
Try.Me.Bug - 08 - One.Two.Three[text].mkv
Try.Me.Bug - 09 - One.Two.Three.[text].mkv
Try.Me.Bug - 07 - One.Two.5.[text].mkv
file_list2
TryMe - 02 - One Two Three [text].mkv
TryMe_-_01_-_One_Two_Three_[text].mkv
TryMe_-_03_-_One_Two_Three_[text].mkv
At the moment the only way to overcome this issue is to use
os_sorted
along withkey=lambda x: re.sub(r'[^a-zA-Z0-9]+', ' ', x)
The text was updated successfully, but these errors were encountered: