Bug 2563 - Incorrect sorting of alphanumeric characters in album display
: Incorrect sorting of alphanumeric characters in album display
Status: RESOLVED WONTFIX
Product: Logitech Media Server
Classification: Unclassified
Component: Player UI
: 6.5.0
: Macintosh All
: P2 normal with 2 votes (vote)
: Future
Assigned To: Chris Owens
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-15 09:01 UTC by sprev
Modified: 2007-10-16 09:29 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sprev 2005-11-15 09:01:36 UTC
If one is browsing one's collection of albums, then titles that are combinations of numbers and letters are sometimes not correctly ordered.

For example, a collection of albums, each labelled 'Piano Sonata X', X  = 1 to 32, gets sorted:

Piano Sonata 1 - Brendel	 	 
Piano Sonata 10 - Brendel	 	 
Piano Sonata 11 - Brendel	 	 
Piano Sonata 12 - Brendel	 	 
Piano Sonata 13 - Brendel	 	 
Piano Sonata 14 - Brendel	 	 
Piano Sonata 15 - Brendel	 	 
Piano Sonata 16 - Brendel	 	 
Piano Sonata 17 - Brendel	 	 
Piano Sonata 18 - Brendel	 	 
Piano Sonata 19 - Brendel	 	 
Piano Sonata 2 - Brendel	 	 
Piano Sonata 20 - Brendel	 	 
Piano Sonata 21 (Waldstein) - Brendel
.
.
.

Notably, iTunes sorts the albums correctly, i.e. #1, #2, #3, #4, ..., #32 in its display. It would be nice if SlimServer could do the same.

(using SlimServer Version: 6.2.0 - 4753 - Mac OS X 10.4.3 (8F46) - EN - utf8)
Comment 1 KDF 2005-11-16 23:42:08 UTC
I found a tweak to adjust a sorting problem in bug 2583, which may also solve this issue.  Have left it for Dan to evaluate since I'm not fluent with the datastore side of things.
Comment 2 KDF 2005-11-18 21:17:44 UTC
please try Nov 19 build of 6.2.2 and let us know if that works.
Comment 3 sprev 2005-11-19 05:30:53 UTC
(In reply to comment #2)
> please try Nov 19 build of 6.2.2 and let us know if that works.
> 

I've downloaded the build from the Nightly for Mac OS X for SlimServer 6.2.2 from: 
http://www.slimdevices.com/downloads/nightly/latest/6.2.2/SlimServer_6_2_x_v2005-11-19.dmg

But either it is not the build suggested, or there is no change in behaviour.

(The nightly has SlimServer Version: 6.2.1 - 5252 - Mac OS X 10.4.3 (8F46) - EN - utf8 as the version information, which doesn't seem right.)
Comment 4 KDF 2006-02-01 01:51:05 UTC
try using 01, and 02 instead of 1 and 2.  just a workaround for now.
Comment 5 Dan Sully 2006-05-01 14:12:48 UTC
This isn't fixable until 6.5 when we move to MySQL.

We need to either use:

ORDER BY SOUNDEX(title);

or:

ORDER BY title + 0;

in order to force a numeric comparison on a alphanumeric column.
Comment 6 Dan Sully 2006-06-13 18:08:31 UTC
Fixed in change 7955 for 6.5
Comment 7 KDF 2006-06-13 19:48:13 UTC
the fix appears to have broken the sort for me.  I'm seeing albums listed by id, not title.
Also, unicode pagebar items are also broken.  reverting change 7955 corrects the break.
Comment 8 Dan Sully 2006-06-14 16:53:35 UTC
Really fixed in change 7983
Comment 9 sprev 2006-10-03 12:14:20 UTC
This still isn't fixed for me in 6.5.0. I get the following listing of album titles:

Piano Sonata - Brendel - #1
Piano Sonata - Brendel - #10
Piano Sonata - Brendel - #11 (Grande Sonata)
Piano Sonata - Brendel - #12 (Trauermarsch)
Piano Sonata - Brendel - #13
Piano Sonata - Brendel - #14 (Moonlight)
Piano Sonata - Brendel - #15 (Pastorale)
Piano Sonata - Brendel - #16
Piano Sonata - Brendel - #17 (The Tempest)
Piano Sonata - Brendel - #18
Piano Sonata - Brendel - #19
Piano Sonata - Brendel - #2
Piano Sonata - Brendel - #20
Piano Sonata - Brendel - #21 (Waldstein)

... and a similar kind of listing any or numbered thing >9.

Any chance this could be fixed?
Comment 10 Dan Sully 2006-10-03 13:25:41 UTC
A work around is to prefix with 0s
Comment 11 Dan Sully 2006-10-03 14:50:07 UTC
Your other work around is to use the album sort tag, and just put the numbers in there.
Comment 12 Jim McAtee 2006-10-03 15:17:44 UTC
Apparently this type of ordering is referred to as a "natural sort".  The + 0 thing only works if the entries are all numeric, as any alpha characters and varying length strings will throw it off.

Is the following of any help?

http://search.cpan.org/~salva/Sort-Key/lib/Sort/Key/Natural.pm

Seems to me that if you're not using a MySQL index for sorting, then using something like this could exact a pretty big performance penalty.  Maybe just use it for album track lists?
Comment 13 Dan Sully 2006-10-09 11:34:16 UTC
This isn't going to be fixed for 6.5.1 or perhaps at all.

Please use the ALBUMSORT tag.
Comment 14 sprev 2006-10-09 11:41:22 UTC
That's a shame---especially since iTunes sorts it correctly. 

Could you explain how to do the workaround with the ALBUMSORT tag?
Comment 15 Dan Sully 2006-10-09 11:45:30 UTC
Im sorry, but we're not iTunes.

If you're using MP3s, set the TSOA (Album Sort) tag.

It would be something like this, for each of the tracks in that 'album'.

Piano Sonata - Brendel - 01
Piano Sonata - Brendel - 10
Piano Sonata - Brendel - 11
Piano Sonata - Brendel - 12

Removing the parens with additional information, and adding a leading 0 to single digit numbers.
Comment 16 sprev 2006-10-09 11:54:41 UTC
Thanks---that's a pity. 

I'm not using MP3s, so I can't use it. The other workaround of putting zeros in front of the numbers just looks odd for Beethoven piano sonatas. I'll just have to live with the incorrect ordering.
Comment 17 Dan Sully 2006-10-09 11:55:22 UTC
What format are you using? They all have something similar.

FLAC or Ogg or Apple Lossless have a ALBUMSORT tag.
Comment 18 sprev 2006-10-09 12:01:17 UTC
I'm using Apple Lossless---is there an easy way to access the album sort tag?
Comment 19 KDF 2006-10-21 12:48:31 UTC
if it's apple lossless, I would expect your only option is whatever iTunes provides.
Comment 20 sprev 2006-10-22 01:46:37 UTC
It doesn't look like I can do anything with the albumsort tag then... I'll live with the behaviour.