Author Topic: Natural sorting for numbers in album names  (Read 4130 times)

mrbenn

  • Full Member
  • ***
  • Posts: 168
Is there a way of doing this via virtual tags?

eg: If I have a set of compilations with volume numbers, it currently sorts 1, 10, 11, 2, 3, etc

If I sort by path it gets it in the natural order.

hiccup

  • Sr. Member
  • ****
  • Posts: 7871
I think this should be possible.
It would need some regex that only adds a zero if the tag starts with a single digit followed by a normal character.
Hopefully somebody with a natural knack and love for regex (and is in a less lazy mood than me) can offer a usable solution?

(perhaps better have it add two zeros if it starts with one digit, and one digit if it starts with two digits? Boxsets comprised of > 99 discs also exist)

PS
It might be good to present an actual tag of yours before anybody puts in effort into this.

mrbenn

  • Full Member
  • ***
  • Posts: 168
I was thinking of a catch-all for any numerical value in an <album> tag.

Generic example:

Various Artists - Iffy Disco Compilation Vol. <number>

These are screenshots with it sorted by album name ascending:

https://imgur.com/N66wndH
https://imgur.com/DumlHlF
https://imgur.com/YWLbijJ
https://imgur.com/SWc7njU

You can see it puts Vol 2 in with the 20's, for example.

Not every case has the number at the end, for example if the format is something like "Disco Compilation 2: A Different Order" but that seems to not actually affect the sort order.

https://imgur.com/jVRRB9d

These examples are from my "tagged and sorted" section, so the folder names are directly derived from their tags (<AlbumArtist> - <Album>/<TrackNo> - <Title>) - if I sort by the file path, I get exactly the "correct" sorting I was looking for, despite the lack of leading 0.

The problem with that is that would only work for me if the folders were correctly formatted, rather than the wildly sketchy naming in the "not sorted" section.


hiccup

  • Sr. Member
  • ****
  • Posts: 7871

frankz

  • Sr. Member
  • ****
  • Posts: 3876
Another example with 3 digits
https://imgur.com/F3vwqdV
That seems to go well? First vol.1, then 10, then 100.
What's wrong there?
Depends on whether there are volumes 2-9 and 11-99  ;D

ikonomov

  • Jr. Member
  • **
  • Posts: 71
Is there a way of doing this via virtual tags?

eg: If I have a set of compilations with volume numbers, it currently sorts 1, 10, 11, 2, 3, etc

If I sort by path it gets it in the natural order.

I totally agree that this is a much needed feature.  I remember a time not long ago when folders and files in File Explorer in windows weren't sorting this correctly, but now they are.  Sorting by path works great for me, thanks to getting the idea from your post, but having the sorting of numbers correctly inside MusicBee for any text fields would be a great improvement to the library.  In fact I think this thread should be moved to Bug Reports.
Last Edit: August 28, 2021, 01:51:33 AM by ikonomov

phred

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 9350
Download the latest MusicBee v3.5 or 3.6 patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
The FAQ
The Wiki
Posting screenshots is here
Searching the forum with Google is  here

ikonomov

  • Jr. Member
  • **
  • Posts: 71
It's not a bug.
https://getmusicbee.com/forum/index.php?topic=19870.0

You are right, it's not a bug, but maybe a feature request for an oversight.  I think it would be a very useful improvement as many of us have compilations with volume numbers in the album title.  Neutron, a music player I use on Android is able to correctly sort numbers in album names.  So numbers can be sorted correctly by the value of the whole number, not just the first digit from a tag's text field.

vincent kars

  • Sr. Member
  • ****
  • Posts: 445
It is called smart sorting.
Musicbee can do it but a bit inconsequential
The listbox on the left does the alpha numerical thing (BWV.1080, BWV.12, etc)
The listbox on the right does it the right way (BWV.12, BWV.147, etc) it sort by number.


ikonomov

  • Jr. Member
  • **
  • Posts: 71
It is called smart sorting.
Musicbee can do it but a bit inconsequential
The listbox on the left does the alpha numerical thing (BWV.1080, BWV.12, etc)
The listbox on the right does it the right way (BWV.12, BWV.147, etc) it sort by number.



Can you give a little more detail on how you've managed to configure the smart sorting.  This would be very helpful.  There is also another thread that I've linked here expressing the same problem so it seems many of us have noticed it.

vincent kars

  • Sr. Member
  • ****
  • Posts: 445
No.
Simply because I didn't configure anything.
Some boxes do sort "smart", others don't

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
You are right, it's not a bug, but maybe a feature request for an oversight.  I think it would be a very useful improvement as many of us have compilations with volume numbers in the album title.  Neutron, a music player I use on Android is able to correctly sort numbers in album names.  So numbers can be sorted correctly by the value of the whole number, not just the first digit from a tag's text field.

Are you opposed to replacing single digit numbers in your tags with padded numbers?
The other available options if not would be sorting with a Virtual Tag or sorting using <Path> as an option.

ikonomov

  • Jr. Member
  • **
  • Posts: 71
No.
Simply because I didn't configure anything.
Some boxes do sort "smart", others don't
Ha.  This is interesting and I think worth noting.  Maybe it has already been done, just a matter of having other fields use the same sorting method.  Hopefully Steven takes notice and finds the motivation to look into it.

Are you opposed to replacing single digit numbers in your tags with padded numbers?
The other available options if not would be sorting with a Virtual Tag or sorting using <Path> as an option.

The Path option works for me, as I've said.  It was just an observation that I thought worth mentioning here.  Quite honestly I was quite surprised to have noticed it, seems like something too significant to have slipped through the cracks unchanged for so long.

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
The Path option works for me, as I've said.  It was just an observation that I thought worth mentioning here.  Quite honestly I was quite surprised to have noticed it, seems like something too significant to have slipped through the cracks unchanged for so long.

It's a purposeful choice made by Steven.
I believe I've read why somewhere before, I can't recall the reason.
I sort albums in one of my primary panels use a complex Virtual Tag, so the sorting issue doesn't affect my library anymore.