FS#2885 - Ignore "the" in alphabetic dir sort

Attached to Project: Rockbox
Opened by Anonymous Submitter - Thursday, 05 January 2006, 17:04 GMT
Last edited by Rani Hod (RaeNye) - Monday, 18 September 2006, 16:48 GMT
Task Type Patches
Category User Interface
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Ignores "The" in the beginning of directory/file names
when alphabetically sorting. Also skips exactly one
trailing whitespace if present.

mutualaid (at)
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Thursday, 21 December 2006, 13:30 GMT
Reason for closing:  Rejected
Additional comments about closing:  general consensus in IRC is that this adds nothing which couldn\'t be done by renaming your files.
Comment by Anonymous Submitter - Thursday, 05 January 2006, 20:55 GMT

Thanks for the patch! does this add an option to turn this
feature on/off? if not, can this option be added?

Comment by Anonymous Submitter - Thursday, 05 January 2006, 23:37 GMT

No, it doesn't add a config option. I would consider this to
be config option bloat; either Rockbox does a "smart sort"
disregarding 'the' or it doesn't, there's little need for
yet another config item.

I *would* like to make it multi-lingual but I have no idea
how Rockbox localization works, or even if there is the
necessary info available for all languages.
Comment by bk01 (bk01) - Tuesday, 10 January 2006, 23:36 GMT

Latest version of this patch is available here:
Comment by Leo Davidson (Nudel) - Sunday, 12 March 2006, 09:20 GMT
Maybe the list should be configurable? Initially I thought maybe as part of the language file but I think it would be better as a separate config file (or string in the main config file) because I imagine people may want to mix prefixes from several languages together.

e.g. In my file manager I can set this as my ignore prefix:

"The |A "

A config file saves you having to think of all the prefixes for every langauge in advance, and means people can include/exclude them to their taste. e.g. Some people may find it weird that "A" is ignored but still want "The" ignored. Of course, having a good default config file in CVS is still important so that people are not forced to configure it, but being able to configure if desired is a plus.
Comment by Ben Keroack (bk) - Tuesday, 14 March 2006, 16:27 GMT
I agree it should be localized somehow, but I think it should be integrated with the existing localization system if possible. There needs to be an item in each language specifying that language's version of "the" (possibly also "A"). I have no idea if that's already provided or if not what it would take to provide it.

If that isn't feasible than an additional config item could be added, but then a parser for it would need to added (because it would be a string with the different ignore tokens separated by delimiters) and probably a GUI menu item and all these would complicate the patch significantly.
Comment by Ketil W Aanensen (kwaanens) - Monday, 18 September 2006, 22:21 GMT
In order to make such a feature really valuable, it would be extremely cool if I make my player do this:
- Ignore "The" always (except for The The which could make some confusion)
Ignore "Billy" in "Billy Bragg" (i.e. an artists' name), but not in "Billy Talent" which is a band name.
Comment by Ketil W Aanensen (kwaanens) - Monday, 18 September 2006, 22:28 GMT
By the way:
When you say "Ignores "The" in the beginning of directory/file names when alphabetically sorting. Also skips exactly one trailing whitespace if present."
Does that mean that "Therapy" will be sorted on "r"? I assuming no, of course.
Comment by Ben Keroack (bk) - Wednesday, 20 September 2006, 23:21 GMT
No, "Therapy" would be sorted normally in the last patch (which is available in the forum thread).

Your suggestions would be addressed if this was implemented as a custom list of 'ignorable' strings (that would fix the localization issue too). However it's not possible for the sort code to distinguish between "Billy Bragg" and "Billy Talent", the string Billy is identical in both and it has no way of knowing that one should be ignored and the other should not.
Comment by Christoph P├Ąper (crissov) - Friday, 22 September 2006, 09:28 GMT
Well, it would be able to sort "Billy" correctly, if it honoured the relevant tag, see
Comment by Keith Barnett (captain_cornflake) - Wednesday, 08 November 2006, 12:46 GMT
Does this also apply when browsing the tag cache, or just when browsing the file system?
Comment by Ben Keroack (bk) - Wednesday, 08 November 2006, 23:43 GMT
Anything that uses the qsort function will be affected, I assume this includes TagCache but I don't know that for sure.
Comment by Max Weninger (maxwen) - Sunday, 12 November 2006, 14:56 GMT
No tagcache has a different compare function.

The attached patch works both in file view and tagcache and also
adds a config option to turn it on and off.

Have fun

Comment by Joe Termini (joetermini) - Thursday, 16 November 2006, 21:09 GMT
hunk error... you need to resync
Comment by Max Weninger (maxwen) - Monday, 27 November 2006, 23:25 GMT
What "hunk error"
It applies cleanly against CVS from 20061120-2230
Comment by Brock Norman (mightybrick) - Thursday, 07 December 2006, 22:08 GMT
I just tried applying to CVS from 20061207-1946 and get a hunk error:
"patching file apps/filetree.c
patching file apps/tagcache.c
hunk #1 succeeded at 1636 (offest 20 lines).
hunk #2 FAILED at 1674."
All other hunks succeed.
Comment by Andrei (andryou) - Tuesday, 12 December 2006, 23:12 GMT
Fixed hunk error reported by Brock
Comment by Max Weninger (maxwen) - Wednesday, 13 December 2006, 00:31 GMT
Added config option to enable/disable the "ignoring"
for id3 view and file view separately

Synced against CVS from today
Comment by Brock Norman (mightybrick) - Wednesday, 13 December 2006, 05:01 GMT
I just tried applying against today's CVS (20061213-0455), and I get the same hunk failure message as before. ???
Comment by Max Weninger (maxwen) - Wednesday, 13 December 2006, 10:49 GMT
Can you please try patch -I (ignore whitespaces)
Maybe I have some wrong tabs instead of spaces in
this file
Comment by Brock Norman (mightybrick) - Wednesday, 13 December 2006, 17:03 GMT
Sorry. It works now. I had issues saving the file correctly. It was a dumb mistake by me. Thanks!