Bugzilla – Bug 11007
Adding all tracks to playlist incorrectly sorts albums
Last modified: 2011-05-09 10:16:34 UTC
Change 8212 for bug 3629 originally fixed this and looks to be correct. I can't track down where exactly the change was made that broke it. The fix is to change server/Slim/Control/Commands.pm, line 2853 from my $albumSort = "concat(album.titlesort, '0'), me.disc, me.tracknum, concat(me.titlesort, '0')"; back to the original my $albumSort = "album.titlesort, me.disc, me.tracknum, me.titlesort"; Appending 0 to the titlesort causes names like Greatest Hits Greatest Hits II to sort incorectly, since 0 is sorted after the space character.
I wonder what the original reason was to introduce this? (appending a zero) Maybe people switching "natural sorting" on and off in Windows? If changed back, this needs to be duly tested. For all other locale-dependent sorting, appending nothing (or *maybe* a blank) should be sufficient, I think.
The change in question is 8427 which looks to have been in response to bug 3729 - can't play all music for a year (but I'm guessing slightly as there's 4 bugs against that commit) Should we make 0 the lowest sorting character in the character set? [not sure what this - space is probably the safest?]
I see a lot of other code in other modules where concat(xxx.titlesort, '0') was later changed to concat('0', xxx.titlesort) Maybe this was just overlooked? Frankly, I can't figure out why you'd need either. The second version should be a noop. Bug 2563 was a request for natural sorting. I can't tell if the appending of a '0' was a failed attempt at a natural sort, or if there was some other reason for it.
is bug 11008 possible a dupe of this bug?
(In reply to comment #4) > is bug 11008 possible a dupe of this bug? I don't believe so.
KDF: your comments on this topic?
I wonder if maybe this concatenation was a holdover from SQLite. There are some old comments in the code about this forcing a numeric sort, which I'm pretty certain MySQL does not do when you append or prepend a zero to a character column.
Many of the concat code was being added while MySQL was already in use. This is not my area of expertise. All of the db code during this time was handled by Dan. I avoided the db code completely aside from capturing logs of the key data. With all of the branching and svn re-organisation it is hard to get an idea of the exact flow of changes around that time (I keep getting errors when requesting annotated versions of old revs). Only Dan could fill in the blanks, if he remembers exactly why those changes were made. Bug 11008 could be related to the same kind of code issues. The browse results aren't always a direct link to the results for a play command as the results are regenerated during the playXcommand call.
Andy notes that Alan was talking about this last week, in the context of needing to change statements using concat for sqlite. Alan does that mean that this behavior is all going to change and we should just plan to review it after that work is done?
I presume that this would indeed all change with new-schema.
JJ: Is this still happening with the latest build?
Sorts correctly in the SQLite branch, incorrectly in the 7.4 Trunk with MySQL.
this is an administrative shuffle on priority fields to help make better judgment on the top end of the priority list. P4->P5, P3->P4, and P2->P3.
Is this still an issue?
7.4.x milestone is in the past
ADded all tracks to playlist----sorted by album in the correct order 7.6.32390