[FRODO]: Use of listitem sorttitle
#1
Hi,

Just want to make sure I'm doing this right, as I cannot get the sorttitle to work.

Below is a example of how I'm setting the values. In this situation, I would expect Zebra to be listed first and Alligator second - but I'm getting Alligator first and Zebra second.

I've tried omitting title and originaltitle, but it makes no difference.

Code:
xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE )
details={'title'     : "Alligator" ,
             'originaltitle': "Alligator" ,
             'sorttitle'  : "Zalligator" }

details_2={'title'     : "Zebra" ,
             'originaltitle': "Zebra" ,
             'sorttitle'  : "AZebra" }
Reply
#2
I had a patch to add sort title I don't think got added. I know I still patch my source for this feature.

Is the an error in your log for xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE?
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
Hi

There's no error messages.

This is the commit, which was added back in July. Or is there a further patch required to enable it fully?

https://github.com/xbmc/xbmc/pull/1067
Reply
#4
PHP Code:
index 089ca07..8cc6c1c 100644
--- a/xbmc/interfaces/legacy/InfoTagVideo.cpp
+++ b/xbmc/interfaces/legacy/InfoTagVideo.cpp
@@ -133,+133,11 @@ namespace XBMCAddon
       
return infoTag->m_strOriginalTitle;
     }
 
+    
String InfoTagVideo::getSortTitle()
+    {
+      return 
infoTag->m_strSortTitle;
+    }
+
     
String InfoTagVideo::getPremiered()
     {
       return 
infoTag->m_premiered.GetAsLocalizedDate();
diff --git a/xbmc/interfaces/legacy/InfoTagVideo.h b/xbmc/interfaces/legacy/InfoTagVideo.h
index e649e4e
..3a5a95c 100644
--- a/xbmc/interfaces/legacy/InfoTagVideo.h
+++ b/xbmc/interfaces/legacy/InfoTagVideo.h
@@ -66,+66,@@ namespace XBMCAddon
        
*/
       
String getLastPlayed();
       
String getOriginalTitle();
+      
String getSortTitle();
       
String getPremiered();
       
String getFirstAired();
     };
diff --git a/xbmc/interfaces/legacy/ListItem.cpp b/xbmc/interfaces/legacy/ListItem.cpp
index b342ea3
..0d4f197 100644
--- a/xbmc/interfaces/legacy/ListItem.cpp
+++ b/xbmc/interfaces/legacy/ListItem.cpp
@@ -336,+336,@@ namespace XBMCAddon
             item
->GetVideoInfoTag()->m_strTitle value;
           else if (
key == "originaltitle")
             
item->GetVideoInfoTag()->m_strOriginalTitle value;
+          else if (
key == "sorttitle")
+            
item->GetVideoInfoTag()->m_strSortTitle value;
           else if (
key == "duration")
             
item->GetVideoInfoTag()->m_duration CVideoInfoTag::GetDurationFromMinuteString(value);
           else if (
key == "studio")
diff --git a/xbmc/interfaces/legacy/ListItem.h b/xbmc/interfaces/legacy/ListItem.h
index 33d6740
..793422b 100644
--- a/xbmc/interfaces/legacy/ListItem.h
+++ b/xbmc/interfaces/legacy/ListItem.h
@@ -179,+179,@@ namespace XBMCAddon
        
*     plotoutline   string (Short Description)
        *     
title         string (Big Fan)
        *     
originaltitle string (Big Fan)
+       *     
sorttitle :     string (Big Fan)
        *     
duration      string (3:18)
        *     
studio        string (Warner Bros.)
        *     
tagline       string (An awesome movie) - short description of movie
diff 
--git a/xbmc/interfaces/legacy/ModuleXbmcplugin.h b/xbmc/interfaces/legacy/ModuleXbmcplugin.h
index 8d05f6a
..92e6588 100644
--- a/xbmc/interfaces/legacy/ModuleXbmcplugin.h
+++ b/xbmc/interfaces/legacy/ModuleXbmcplugin.h
@@ -103,+103,10 @@ namespace XBMCAddon
      
sortMethod  integer number for sortmethod see FileItem.h.
      * 
label2Mask  : [optstring the label mask to use for the second label.  Defaults to '%D'
      
*               applies toSORT_METHOD_NONESORT_METHOD_UNSORTEDSORT_METHOD_VIDEO_TITLE,
-     *                           
SORT_METHOD_TRACKNUMSORT_METHOD_FILESORT_METHOD_TITLE
-     *                           SORT_METHOD_TITLE_IGNORE_THESORT_METHOD_LABEL
-     *                           SORT_METHOD_LABEL_IGNORE_THE
+     *                           SORT_METHOD_TRACKNUMSORT_METHOD_FILESORT_METHOD_TITLE,
+     *                           
SORT_METHOD_TITLE_IGNORE_THESORT_METHOD_LABEL,
+     *                           
SORT_METHOD_LABEL_IGNORE_THESORT_METHOD_VIDEO_SORT_TITLE,
+     *                           
SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE
      

      * 
example:
      *   - 
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_TITLE)
@@ -
214,+215,@@ namespace XBMCAddon
     SWIG_CONSTANT
(int,SORT_METHOD_PLAYLIST_ORDER);
     
SWIG_CONSTANT(int,SORT_METHOD_EPISODE);
     
SWIG_CONSTANT(int,SORT_METHOD_VIDEO_TITLE);
+    
SWIG_CONSTANT(int,SORT_METHOD_VIDEO_SORT_TITLE);
+    
SWIG_CONSTANT(int,SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE);
     
SWIG_CONSTANT(int,SORT_METHOD_PRODUCTIONCODE);
     
SWIG_CONSTANT(int,SORT_METHOD_SONG_RATING);
     
SWIG_CONSTANT(int,SORT_METHOD_MPAA_RATING); 

i'll have to check further as it didn't work for me without this patch, but if some of this wasn't in there, i would have thought you would have gotten an error message.
the above patch is needed to set the sorttitle on the listitem and add the appropriate sort method. i'll add a trac ticket.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#5
Well, I'm confused now.

There is a Pull request and Commit for this to go into Master from 4-6 months ago - yet when I browse the existing code I cannot find the actual line you've highlighted. I'm guessing it was reversed at some point (although for some reason the code at that point doesn't have this legacy directory).

It shows up in the pydocs here: http://mirrors.xbmc.org/docs/python-docs/ as well, although they are a few months out of date.

So, i'm guessing that this is removed? It's not a big deal, I'll just go back to sorting on the title and wait for it to appear next year.
Reply
#6
It was probably (accidentally) dropped when things switched to code generation of the python API.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#7
Not all of it was removed. The patch on trac fixes it. Still not sure why you didn't get an error.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#8
(2012-12-10, 01:10)jmarshall Wrote: It was probably (accidentally) dropped when things switched to code generation of the python API.

Just tried it in 12.1 and it doesn't appear to work. Was this fixed in 12.1 or should I raise a ticket for it?
Add-on:PleXBMC (wiki) - Play Plex media through XBMC
PleXBMC Helper - Integrate Official/Unoffical Plex remote control apps into PleXBMC
PleXBMC Repository - install and manage all PleXBMC addons
Quartz3 PleXBMC - Integrate PleXBMC into home menus
Reply
#9
it works fine here on latest git, how are you using it.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#10
Hmmm - you right . Just put together a simply test (based on my first post) and they are working now. So why isn't it working in my plugin - off to investigate.

EDIT: Ah-ha - my plugin is a obviously getting a bit complex now - I was following the wrong chain of functions - so I wasn;t actually activating sort on sorttitle..
Add-on:PleXBMC (wiki) - Play Plex media through XBMC
PleXBMC Helper - Integrate Official/Unoffical Plex remote control apps into PleXBMC
PleXBMC Repository - install and manage all PleXBMC addons
Quartz3 PleXBMC - Integrate PleXBMC into home menus
Reply

Logout Mark Read Team Forum Stats Members Help
[FRODO]: Use of listitem sorttitle0