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: Default UI lexicographic order incorrect (Read 5487 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Default UI lexicographic order incorrect

Somewhat of a modified repost from one of the 1.0 beta threads:

I think foobar2000's lexicographical sorting is wrong.
In the Library Viewer Selection, if I create a custom group that sorts by
Code: [Select]
%album artist% - %album%

then foobar2000 displays the list
Code: [Select]
ArtistA - AlbumAA
ArtistA - AlbumA
ArtistB - AlbumA

instead of
Code: [Select]
ArtistA - AlbumA
ArtistA - AlbumAA
ArtistB - AlbumA


When I noticed it happen, the extra A was whitespace. Shouldn't whitespace be lexocigraphically after null? Windows seems to displays it the 2nd (correct?) way.  I'm pretty sure that any string sorting algorithm should show that strings of shorter length always preceed the same string with a set of extra characters at the end, thus confirming the issue.

Default UI lexicographic order incorrect

Reply #1
Any word on whether this is considered an issue, and if yes, whether it'll be fixed?

Default UI lexicographic order incorrect

Reply #2
I added three files into a playlist, changed their tags as shown above, added a column "%album artist% - %album%", clicked it to sort.
The items appeared in order (for different variations, I didn't fully understood your point about whitespace):
[font= "Courier New"]"ArtistA - AlbumA"
"ArtistA - AlbumAA"
"ArtistB - AlbumA"

"ArtistA - AlbumA"
"ArtistA - AlbumA "
"ArtistB - AlbumA"

"ArtistA - Album "
"ArtistA - Album  "
"ArtistB - Album "[/font]
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #3
In the Library Viewer Selection, if I create a custom group

Do you mean the "Album List" viewer?
In theory, there is no difference between theory and practice. In practice there is.

Default UI lexicographic order incorrect

Reply #4
The common tree view control does the sorting there, IIRC. And interestingly, StrCmpLogicalW() says [font= "Courier New"]"ArtistA - AlbumA (1)"[/font] >  [font= "Courier New"]"ArtistA - AlbumA  (1)"[/font].
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #5
GeSomeone:
I would guess he means what he says.
elevatorladylevitateme

Default UI lexicographic order incorrect

Reply #6
I reproduced it. I seems to happen when sending from the Album List to the Library Viewer Selection. It looks like foobar is including the sub item count when it sorts. E.g. I have this album list pattern: %album artist%|%album%|%tracknumber% %title% and clicking on Melvins gets me this:

But if I use the pattern %album artist%|%album% I get them sorted how you might expect.

Default UI lexicographic order incorrect

Reply #7
Playlists generated from Album list are always sorted in the exact same order they appear in the Album list itself.
(If one node contains more items without further branching, their order is undefined.)
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #8
How do you explain my first screen shot then?

Default UI lexicographic order incorrect

Reply #9
I didn't really looked at them
You had the "Gluey Porch Treatments" subbranch selected, then clicked on the parent "Melvins" one, and it added only the difference at the end of the existing playlist?
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #10
No, I checked, it's not that.

This was discussed in the 1.0 beta 2a thread, and windows explorer sorting was mentioned, it looks like explorer includes the file extension when it sorts, so that's why I thought foobar might be including the sub item count.

Default UI lexicographic order incorrect

Reply #11
Aha, it's the separator. The Album List sorts the entries by the whole pattern when putting them to a playlist etc., and "[font= "Courier New"]ArtistA|AlbumA|anything[/font]" > "[font= "Courier New"]ArtistA|AlbumA (remixes)|anything[/font]" then.
Sorry about the confusion, it's not "always in the exact order the tree itself uses", but technically it also is, the difference can be seen only in this case when the lexicographic order is influenced by neighboring characters.
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #12
In that case, shouldn't everything after the last separator be ignored in the context of playlist view sorting? That way the Library Viewer Selection view corresponds to the Album List view?

Edit: Though looking back, I don't understand how foobar2000 deals with the sorting pattern after the last separator. If I do "%album artist%|%artist%", the orders identical.. so there's a branching parent node (All Music), a branching child node (album artist) and finally a non-branching child node (artist). If I tack on, say, "|%track%", then it sorts:

All Music
+ArtistA
--AlbumA
--AlbumAA


in the Album List, but clicking on All Music (or ArtistA) shows AlbumAA followed by AlbumA in the Library Viewer Selection. Is the string (which string? the sort pattern with the appropriate fields replaced by metadata? the one shown in the Album List [and if yes, are child nodes taken into consideration, and if yes, how]?) concatenated then compared? I guess I'm asking a couple of things: why the discrepency and how exactly are both sorted?

Default UI lexicographic order incorrect

Reply #13
As I understand it, each node is put in the alphabetic sorted order of its label into the tree. Each node also contains a list of tracks it contains, for use with Add/Send to playlist, Copy, drag & drop, etc., in the alphabetic order of the whole pattern.

"AlbumA" is sorted before "AlbumAA" under "ArtistA", because "AlbumA" < "AlbumAA".
When selected, it's the other way, because "ArtistA|AlbumA|Track..." > "ArtistA|AlbumAA|Track...".
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #14
Ah, so a literal |. In that case, the pipe should be the last character lexicographically in the context of sorting patterns, or the everything after the last | should be ignored in the same context.. unless there's a better way.

Edit: While I'm at it, if you make a custom view under Album List in the preferences, subsequently select that view in the Album List itself, then remove the view from the preferences, the Album List displays

All Music
-N/A

Should either select the first view or the last view instead of none (since you can't select none normally).

Default UI lexicographic order incorrect

Reply #15
Ah, so a literal |. In that case, the pipe should be the last character lexicographically in the context of sorting patterns, or the everything after the last | should be ignored in the same context.. unless there's a better way.
Well, yes, but the sorting is not done by some homemade function, it uses relevant Windows API function to handle all the Unicode peculiarities properly, and it just happens to think like this for the pipe character.
In other contexts (for example Edit > Sort by...), you are free to use any other character as a splitter, or none at all.
In the Album List, the | has the special function to separate branching levels, and it also looks appropriate for that... Changing the separator to something else (a simple space maybe?) during that last sorting before outputting tracks to a playlist etc. might help.
Full-quoting makes you scroll past the same junk over and over.

Default UI lexicographic order incorrect

Reply #16
So there's no way to keep the branching and have proper sorting.

Default UI lexicographic order incorrect

Reply #17
as you're using columns UI, you can use library tree instead.

sorry. missed the thread title and was looking at TomBarlow's screenshots. oops.

Default UI lexicographic order incorrect

Reply #18
Interesting. According to http://blogs.msdn.com/michkap/archive/2006/10/01/778990.aspx , you can at least tweak the behaviour of the ".".

But this function seems not very well documented. How does it alphabetize special chars, really? Looks to me that most special chars end up first, and it would be convenient to know one which (1) ends up at the end and (2) is easily accessible from the search bar. (I'd like to use that as a "various artists" indicator ... edit: alt + 999 is easy enough to remember.)



(The web search also led to this: http://www.utilitycode.com/str/default.aspx )

Default UI lexicographic order incorrect

Reply #19
it would be convenient to know one which (1) ends up at the end and (2) is easily accessible from the search bar. (I'd like to use that as a "various artists" indicator ... edit: alt + 999 is easy enough to remember.)

Ah, the Greek letter Tau it was.

Alt + 234 gives Greek capital Omega, which is not in any of my tags, but then I discovered a Cyrillic, http://www.discogs.com/artist/?l...;?? . Half an hour's googling did not bring me any closer to a complete charmap and alt-code map ... <grrr>m$</grrr>.

I'm sticking with the Omega at <Rammstein>Links-2-3-4</Rammstein> as a Various Artists indicator, at least until I get music with that symbol in tags. The Russian band was retagged from ????? (Kruiz) to Kruiz (?????), moving into "K" in the alphabet.

Default UI lexicographic order incorrect

Reply #20
Foobar also lists numbers ahead of brackets, while Windows does the opposite (which does look better to me subjectively, but I'm not an expert on the great art of lexicographic sortin')

Re: Default UI lexicographic order incorrect

Reply #21
Bringing this back alive because it's still fubar (hah!).

Basically, to illustrate the issue again:



#1 - This is the Album List component, with the view set to "by folder structure" (not visible). So far so good. Sorting is correct there as "Florence" < "Florence (Remixes)".
#2 - This is the Playlist View component, showing the Library Viewer Selection build-in playlist. It is grouped using one of the built-in groups, "By artist/date/album".
#3 - Library Viewer Selection showing the sorting. Obviously the groups are sorted incorrectly as once again "Florence" < "Florence (Remixes)".

Here's what's even more annoying:



Using the built-in "Album/artist" column (which I presume has a pattern of "%album% - %artist%"), if you sort using that column, the group sorting is correct.

Realistically it should be possible to have the groups sort correctly by using the group pattern.

Per Yirkha, "The Album List sorts the entries by the whole pattern when putting them to a playlist".

Using the terminology from Microsoft's site regarding tree views: sounds like the remedy is for the Album List to sort sort not by the whole pattern, which includes the pipes (to separate containers in the tree view) that causes the issue, but rather by the container nodes hierarchy first, then the leaf nodes. A nice and easy recursive node sort.

Re: Default UI lexicographic order incorrect

Reply #22
The album list doesn't sort the tracks when it exposes them to the library viewer playlist. Please take a look at the string in preferences for sorting incoming files by. Group settings make no guarantee about sort order, and will happily produce a bunch of disjointed groupings if the tracks load out of order.

 

Re: Default UI lexicographic order incorrect

Reply #23
The album list doesn't sort the tracks when it exposes them to the library viewer playlist. Please take a look at the string in preferences for sorting incoming files by. Group settings make no guarantee about sort order, and will happily produce a bunch of disjointed groupings if the tracks load out of order.

Preferences -> Shell Integration -> 'Sort incoming files by' doesn't have any effect on the Library Viewer Selection playlist, at least when used in conjunction with the Album List element.

Re: Default UI lexicographic order incorrect

Reply #24
Hmm, then I guess it's a feature of the Media Library viewer you happen to be using? I'll have to investigate further...