Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Sort tokens and foreign titles
#1
Is it possible to add a token to sort movies whose titles begin with L' ?
Reply
#2
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).
Reply
#3
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.
Reply
#4
unless those movies are named 'l' ', that is the ' is followed by a space, it won't work
Reply
#5
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?
Reply
#6
it's not hard, see StartsWithToken in SortFileItem.cpp
Reply
#7
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>
Reply
#8
trac a diff and i'll see if we can't do this by default

cheers
Reply
#9
spiff:-

Maybe we should specific the token delimeter in our advancedsettings if we aren't already ..
The normal XBMC log IS NOT a debug log, to enable debug logging you must toggle it on under XBMC Settings - System or in advancedsettings.xml. Use XBMC Debug Log Addon to retrieve it.
Reply
#10
Patch submitted

http://trac.xbmc.org/ticket/6876
Reply
#11
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?
Reply
#12
(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>
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#13
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:
Reply
#14
Actually thinking about I'm not sure this is an appropriate use of sort tokens, so I'm not convinced anything would work.
Reply
#15
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>
Reply

Logout Mark Read Team Forum Stats Members Help
Sort tokens and foreign titles0