[mythtv] Question to awithers about mythvideo title sorting

Michael T. Dean mtdean at thirdcontact.com
Wed Jul 11 03:34:08 UTC 2007


On 07/10/2007 09:41 PM, Bill wrote:
> I have a question of video sorting by title. Mythvideo does not sort the 
> videos exactly as I wish and I found that it is due to be the way the sort 
> key is generated in Metadata::GenerateDefaultSortKey which is called by 
> VideoFilterSettings::meta_less_than.
>
> The sortkey is generated as: QString ret(title + m.Filename() + 
> QString().sprintf("%.7d", m.ID()));
> which essentially appends the filename and id to the video title.
>
> I prefer the part 1,2,3 movies to be sorted in order, the above prevents 
> this.  For example, the Mission Impossible movies are sorted as:
>
>         Mission Impossible Part III
>         Mission Impossible Part II
>         Mission Impossible
>
> I prefer the opposite.  If I remove the filename and id from the key (ie. 
> "return title" in GenerateDefaultSortKey) they are sorted as I wish them to 
> be.
>
> Is there a reason that the filename and ID are appended?

Because title is not a unique key.  See Descent (
http://www.imdb.com/find?q=descent ) or King of the Hill (
http://www.imdb.com/find?q=king+of+the+hill ) or ...

>   Would it be ok if 
> I submitted a patch to change it?  If not could you suggest an alternate way 
> for the patch, I'd be willing to code it if you can give some guidance on 
> what you'd like to see.

Anduin will have to answer the question about patches and possible
alternate approaches, but you should probably see all of the following
threads for some history:


http://svn.mythtv.org/trac/ticket/1354
http://www.gossamer-threads.com/lists/mythtv/dev/184376#184376
http://svn.mythtv.org/trac/ticket/1569
http://www.gossamer-threads.com/lists/mythtv/dev/192838#192838
http://svn.mythtv.org/trac/ticket/1678
http://www.gossamer-threads.com/lists/mythtv/dev/199208#199208

Note that the patches in #1569 and #1678 were never applied to
MythVideo, but instead, when doing his major rewrite of MythVideo,
Anduin fixed the issues that were described those tickets (i.e. he
pretty much rewrote most of MythVideo, so the patches weren't applicable).

IMHO, the /only/ way to allow user-specified sorting is to provide a
default value for a sort key that can be modified by the user (as in the
patch in #1678).  With any other approach, you'll have problems:

a) By appending data to account for non-uniqueness of titles, you'll
prevent shortest string (i.e. without "2" or "II" for the sequel) from
sorting first.  (Your issue.)
b) Some users want to strip articles from titles for sorting, but doing
so may break things.  For example, the German article "die" should be
stripped from German film titles, but not from "Die Hard with a
Vengeance" in a system that uses a German localization.
c) Since sorting is being done using QT's i18n support (I'm assuming
that got rolled into the rewrite instead of the old ASCII-betical
sort)--which assumes only one locale is in use--users with videos having
a mix of titles in different languages will have mis-sorted titles.  For
example, the letter "AE" (Latin capital letter AE) would sort after Z/z
on a system using the US-English locale, so AEon Flux (when inserted
with the "proper" "AE" character) would sort after Zorro.  (The user can
get around this by using "Aeon Flux"--with an "A" and and "e"--as the
title, but...)
d) Probably others that I'm not seeing.

However, I (the one who wrote the unapplied DB sort key patch) am
perfectly happy with Anduin's current solution and feel that a sort key
patch may not be worth the effort.  I should also admit that I'd much
rather see MythVideo get rolled into the backend/frontend functionality
(and the plugin removed) so there's only one place to go to watch
recordings, videos, optical discs, streams, ...  (but that one should
wait until at least after 0.21 is released) so I'm seeing changes to the
current MythVideo as "temporary" fixes.  :)

HTH,
Mike


More information about the mythtv-dev mailing list