Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Incorrect sorting of numbers (Read 1861 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Incorrect sorting of numbers

Ok well its hard to know if its the playback statistics' fault or with foobar but I'll describe it anyways.

Playback statistics basically counts how many times you play a song, well if you've got songs that have been played twice or 20 times, when you try to sort the songs by how often they've been played. Instead of the songs that have been played 20 times being at the top or bottom of the list, it is inline with the songs that have been played twice. I believe the issue is with the fact that it sorts the songs only by the first number prefix and doesn't account for the 0 making it twenty instead of 2.

So the songs that have been played 10-19 times are considered played more than the songs that have been played once but are also less than the songs that have been played twice or 20 times... Now that I think about it, I believe foobar or the playbackstatistics is treating the second number as a decimal.

 

Incorrect sorting of numbers

Reply #1
This is not a bug.

When you sort playlist items by a certain titleformat expression like %play_count%, the items are sorted as strings, and not numbers.

You can fix this by using $num(%play_count%,9) to insert leading zeros in front of the numbers.