Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add natural sorting for tracks and filters #73

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

guillermofbriceno
Copy link
Contributor

Firstly I'd like to say I've been looking for a music player for Linux like this one for years, so thanks for your work!

At the moment, Fooyin uses ASCII-order sorting for the library, as is also the case for most other players I've used. For a music player, I believe natural sorting should be used instead. The core argument for this goes pretty far back, but in our case, consider the current sorting of some Bach works with their commonly used Opus number:

BWV 1
BWV 10
BWV 100
...

Using QCollator instead, the player will use a natural sort more similar to the behavior of foobar2000:

BWV 1
BWV 2
BWV 3
...

I am a C programmer by trade so there might be some bad code here.

@ludouzi
Copy link
Collaborator

ludouzi commented Apr 29, 2024

Thanks for the contribution! I agree that natural sorting should be preferred for user-facing strings and cases such as this.

The changes look good here. I wasn't aware of QCollator before now, so thanks for bringing it to my attention. LibraryTree also uses a simple locale-aware sort and should be switched over to use QCollator, but I'll do so separately.

@ludouzi ludouzi merged commit 407585b into fooyin:master Apr 29, 2024
8 checks passed
@guillermofbriceno guillermofbriceno deleted the natural-sort branch April 29, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants