Bugzilla – Bug 18131
Bug #3096 returns
Last modified: 2015-05-13 10:55:30 UTC
Bug fix #3096 at line 155 in Contributor.pm no longer works. It is currently: [code] # Bug 3069: update the namesort only if it's different than namesearch if ( $search ne $sort ) { $sth = $dbh->prepare_cached('UPDATE contributors SET namesort = ? WHERE id = ?'); $sth->execute( $sort, $id ); } [/code] The problem is that at some point, the sort form was extended to included accented characters (in lower case) whereas the search form never includes accents (although the characters that are accented in the sort form are in lower case). So for accented default sort forms $search is always 'ne' $sort. This means that perfectly good sort forms derived from ArtistSort get overwritten when, for instance, an Artist is also a Composer or Conductor and brings a default sort form. This is was the original good bug fix was meant to do. I did a test run with a 'bodge' to prove my theory, and it worked. I just did: [code] if ( substr($search,0,3) ne substr($sort,0,3) ) { [/code] On the basis that for most of my problem artists the accents are later in the name. What is needed is a proper fix knowing how and why the default sort and search forms are different for accented names, and a function to make the comparison work properly. I thought of trying 'unidecode' but my Perl knowledge, and multi-language unicode knowledge, are both close to zero. so I thought better of it. Without this fix, Artist and AlbumArtist menus in LMS are in a random order for many of my artists, and very frustrating to try and use.
I've now tested what I believe is a 'correct' and self-consistent fix taht shouldn't cause any grief to anyone. The offending line in my Contributor.pm is now: [code] if ( $search ne Slim::Utils::Unicode::utf8toLatin1Transliterate($sort) ) { [/code] I got the function from looking at how namesearch ($search) is derived and applying the same function to namesort ($sort).
I now believe this problem was introduced earlier than I thought, with the fix for #16956 in Text.pm and the call from Contributor.pm to remove accents from the namesearch field. My proposed fix should sort it. I know it may seem trivial, but 'tis a real nuisance for me, and the fix is logical and simple.
Created attachment 7740 [details] A patch to re-fix bug #3096 A diff file is attached for linux/ubuntu patch /usr/share/perl5/Slim/Schema/Contributor.pm
Sorry, the line should read: patch /usr/share/perl5/Slim/Schema/Contributor.pm Contributor.diff (I wish I could edit comments....)
Just a note to say that this fix resolves a problem when: either LMS does not support ComposerSort, ConductorSort, BandSort etc (as is the case unless #18096 is accepted and implemented) or there are no (or only partial) ComposerSort, ConductorSort, BandSort etc tags in the music files (regardless of LMS support for such tags)
commit f590592f7d385de3ac5064d89ed26ca45eb82e6d
Michael - did anyone ever tell you you're a star? Thanks.
Re-tested in Logitech Media Server Version: 7.9.0 - 1431440256 @ Wed May 13 04:05:18 UTC 2015. Fixed. Thanks.