[mythtv-users] MythVideo: file name sorting oddity

Michael T. Dean mtdean at thirdcontact.com
Thu Dec 13 18:02:28 UTC 2007


On 12/13/2007 06:43 AM, Brion Swanson wrote:
> On 12/12/07, Anduin Withers <awithers at anduin.com> wrote:
>   
>> Sorting sucks. As for it making sense, sort T. S. Elliot and Trotsky. Did
>> you compare r to . or S? The example is contrived but if you look at the
>> confused sorting you currently see and pretend you skip the . before the
>> extension it makes sense.
> Is this a problem that we can push out to the user at all?  I mean, Myth can
> take a stab at it's best guess for sorting, but then add to Myth the
> configurable option to sort based on different criteria.

I am NOT recommending that Anduin update/apply the patch--as I don't
think it's worthwhile (especially since effort would be better spent
integrating MythVideo into mythfrontend/mythbackend), however, for those
who are really concerned about sort order, check out
mythplugins-mythvideo-titlesortkey_in_database-2.patch at
http://svn.mythtv.org/trac/ticket/1678 .  It's 2 years old and from
before the pretty major reorg of MythVideo, so it would need a /lot/ of
work to be usable with today's MythVideo, but it's a framework you could
use to "push [the problem] out to the user."  (I'm the author of the
patch, so I feel I can recommend against its use in MythVideo proper. 
If users decide to update/use it in their own versions of MythVideo,
that's fine.)

Anduin did not apply the patch when he did the major rework of
MythVideo.  Instead, he chose a simpler approach that solved the
majority of the sorting issues that were visible to users.  Since he
solved the issue reported in #1678 (by someone else), I was happy that
MythVideo's sorting was "good enough"--i.e. it was relatively intuitive,
straightforward, and--most importantly--is relatively simple.  The
/only/ reason I did all those different patches for that ticket is ... 
Well, it's a long story.

>   In other words,
> Myth's default is to sort based on title metadata in the natural ordering
> provided by the local or database or whatever.  But if the user chooses,
> they can indicate to Myth to sort by file name (case [in]sensitive and / or
> matching a pattern for unconsidered characters), or perhaps they wish to
> sort by some other metadata criteria (such as genre) and within the genre
> they files are sorted as Myth's default (maybe more options are added for
> n-level sorts, but probably not).  Thoughts?
>   

Using an approach like in the patch is a much more flexible approach
than using existing metadata; however, it only allows a single sort
order.  It could be extended to include many different sort keys,
but--again--I don't think it should be applied to current MythVideo.

>> [test in another e-mail where collation and ls don't work]
>>
>> I don't Ubuntu, but ls should be honoring your locale setting (ls
>> --sort=none should confirm it normally sorts).
> I ran this command and did verify that ls does sorting - the locale
> environment variable simply had no effect on the order.

Use:

LC_ALL=C ls -1
LC_ALL=en_US ls -1


Depending on your system configuration, you may need more than just
LC_COLLATE specified (other locale env vars can override the collate).

Mike


More information about the mythtv-users mailing list