[mythtv-commits] Ticket #1678: mythvideo sorting is case-sensitive

MythTV mythtv at cvs.mythtv.org
Sat Apr 15 17:23:12 UTC 2006

#1678: mythvideo sorting is case-sensitive
 Reporter:  thomas at boerkel.de  |        Owner:  ijr 
     Type:  patch              |       Status:  new 
 Priority:  minor              |    Milestone:      
Component:  mythvideo          |      Version:  0.19
 Severity:  low                |   Resolution:      
Changes (by sphery <mtdean at thirdcontact.com>):

  * type:  defect => patch


 Attached patch fixes the issue described here by removing the QMap quick-
 and-easy sort and instead using a new "SortableMetadataList" class to do
 the sort.  As a side-effect of this change, the patch also:

 * Provides a locale-aware comparison (rather than using Unicode values),
 so sorting titles with umlauts, etc. will be correct

 * Appends the filename to the title to act as a "secondary" sort key (per
 George Nassus's desires as expressed in #1569 and http://www.gossamer-
 threads.com/lists/mythtv/dev/192838#192838 )

 * Appends a zero-padded video ID to the title/filename key to act as a
 "tertiary" sort key (the secondary sort key fails if filenames are
 identical except for case, even if lower() is called before appending the

 * Does a case-insensitive sort--regardless of the locale's LC_COLLATE
 preference (US English sorting according to LC_COLLATE is case-sensitive,
 which seems against the reporter's wishes)

 The compareItems() function is rather verbose to allow the committer to
 more easily change it's behavior.  This is the only reason each change was
 made on a separate line, so feel free to condense the lines as desired.
 Note, also, that using filename as a secondary sort key is a new addition.
 Current SVN head is using the video ID as a secondary sort key since

 After the patch, the only "unusual" behavior occurs when there exist at
 least two identically-titled (including case) videos in different
 directories and at least one with a similar title, differing only in case.
 In this situation, the identically-titled videos may be separated from one
 another by the video(s) with similar titles and different case.  The same
 holds true where the titles differ only by an indefinite article at the
 beginning.  Although it's possible to work around this (sort by case when
 titles are otherwise identical and include the article in the sort key
 when it is the only difference), I feel it's enough of an edge case (far
 out on the fringes of reality) that it's not worth the extra
 code/processing time.  Let me know if you disagree.  :)

Ticket URL: <http://svn.mythtv.org/trac/ticket/1678>
MythTV <http://www.mythtv.org/>

More information about the mythtv-commits mailing list