Kodi Community Forum
Sort tokens and foreign titles - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Sort tokens and foreign titles (/showthread.php?tid=54168)

Pages: 1 2


Sort tokens and foreign titles - proctor - 2009-07-07

Is it possible to add a token to sort movies whose titles begin with L' ?


- rimsky82 - 2009-07-07

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).


- proctor - 2009-07-08

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.


- spiff - 2009-07-08

unless those movies are named 'l' ', that is the ' is followed by a space, it won't work


- proctor - 2009-07-08

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?


- spiff - 2009-07-08

it's not hard, see StartsWithToken in SortFileItem.cpp


- proctor - 2009-07-08

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>



- spiff - 2009-07-08

trac a diff and i'll see if we can't do this by default

cheers


- CrashX - 2009-07-08

spiff:-

Maybe we should specific the token delimeter in our advancedsettings if we aren't already ..


- proctor - 2009-07-08

Patch submitted

http://trac.xbmc.org/ticket/6876


RE: Sort tokens and foreign titles - Skirge01 - 2022-11-10

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?


RE: Sort tokens and foreign titles - Karellen - 2022-11-10

(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>



RE: Sort tokens and foreign titles - jjd-uk - 2022-11-10

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:



RE: Sort tokens and foreign titles - jjd-uk - 2022-11-10

Actually thinking about I'm not sure this is an appropriate use of sort tokens, so I'm not convinced anything would work.


RE: Sort tokens and foreign titles - jjd-uk - 2022-11-10

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>