Kodi Community Forum

Full Version: Sort tokens and foreign titles
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Is it possible to add a token to sort movies whose titles begin with L' ?
You can add sort tokens by using advancedsettings.xml . You can search the wiki for exact directions, or paste this text into a file called advancedsettings.xml and put it in your userdata folder.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<advancedsettings>
    <sorttokens>the|l'</sorttokens>
</advancedsettings>

Edit: Just to clarify, adding these tokens will make xbmc ignore them when sorting movies (so "L'Enfants" would be sorted under "E"). I assumed this was what you were asking. You can add more tokens by separating them with a | (pipe).
This is what I have in advancedsettings.xml

Code:
<sorttokens>
                <token>the</token>
                <token>a</token>
                <token>le</token>
                <token>la</token>
                <token>les</token>
                <token>l'</token>
        </sorttokens>

But, the L apostrophe doesn't work.
unless those movies are named 'l' ', that is the ' is followed by a space, it won't work
That's what I figured. Is it hard to change the code to treat ' as a delimiter? Or do I have to rename all of my movies (approx 100 like this) instead?
it's not hard, see StartsWithToken in SortFileItem.cpp
Ok, I figured it out.

For anyone interested, open up Settings.cpp and locate this code at line 1376

Code:
if (pToken->FirstChild() && pToken->FirstChild()->Value())
      {
        g_advancedSettings.m_vecTokens.push_back(CStdString(pToken->FirstChild()->Value()) + " ");
        g_advancedSettings.m_vecTokens.push_back(CStdString(pToken->FirstChild()->Value()) + ".");
      }

And change it to this:

Code:
if (pToken->FirstChild() && pToken->FirstChild()->Value())
      {
        g_advancedSettings.m_vecTokens.push_back(CStdString(pToken->FirstChild()->Value()) + " ");
        g_advancedSettings.m_vecTokens.push_back(CStdString(pToken->FirstChild()->Value()) + ".");
        g_advancedSettings.m_vecTokens.push_back(CStdString(pToken->FirstChild()->Value()) + "'");
      }

And in your advancedsettings.xml

Code:
<sorttokens>
                ...
                <token>l</token>
     </sorttokens>
trac a diff and i'll see if we can't do this by default

cheers
spiff:-

Maybe we should specific the token delimeter in our advancedsettings if we aren't already ..
I realize how old this thread is, but it's very close in relevance to what I'm trying to fix.  I have a few movies that start with an apostrophe < ' >, followed by a word, such as 'Twas or 'Tis, but I can't get Kodi to ignore the apostrophe with the sort tokens, so it sorts them by the letter 'T'.  I also tried adding a "blank" separator like below, but that also didn't work.

Code:
<token separators="'"></token>

Is there a way to accomplish this?
(2022-11-10, 04:10)Skirge01 Wrote: [ -> ]<token separators="'"></token>
Can you try the following and see if it works. I think the problem is that you need to add a value.

xml:
<sorttokens>
<token separators="'">T</token>
</sorttokens>
I don't think you need the separator in this case, as I believe that's only needed you have a sort article including a delimiter with no space to what you want to sort by.

So you could also try

Code:
<token>'T</token>
xml:
Actually thinking about I'm not sure this is an appropriate use of sort tokens, so I'm not convinced anything would work.
After some more thought I wonder is this would work

xml:
<token separators="'">'</token>

So the apostrophe is both the token and separator, since I believe the way it works is

<sort token><separator><word on which sort begins>
Pages: 1 2