Kodi Community Forum
It's possible to set a "custom" SORT_METHOD? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: It's possible to set a "custom" SORT_METHOD? (/showthread.php?tid=370794)



It's possible to set a "custom" SORT_METHOD? - sagrath - 2022-12-15

I have these ListItem:

Code:
listitem.setInfo('video', {
            'title'   : issue_name,         'premiered': issue['m_date'],
            'genre'   : issue['m_genre'],   'studio'   : issue['m_publisher'],
            'rating'  : issue['m_rating'],  'plot'     : issue['m_plot'],
            'path'    : issue['filename'],  'year'     : issue['m_year'],
            'overlay' : ICON_OVERLAY,     
            })
        listitem.setProperty('issue', issue['id'])
        listitem.setProperty('issue_number', issue['m_number'])
        listitem.setProperty('issue_title', issue['m_title'])
        listitem.setProperty('name', issue['m_name'])        
        listitem.setProperty('magazine_name', issue['m_magazine'])        
        listitem.setProperty('issue_style', issue['m_style'])

and i have these Sort Methods

Code:
        xbmcplugin.addSortMethod(handle = self.addon_handle, sortMethod = xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.addSortMethod(handle = self.addon_handle, sortMethod = xbmcplugin.SORT_METHOD_LABEL_IGNORE_FOLDERS)
        xbmcplugin.addSortMethod(handle = self.addon_handle, sortMethod = xbmcplugin.SORT_METHOD_VIDEO_YEAR)
        xbmcplugin.addSortMethod(handle = self.addon_handle, sortMethod = xbmcplugin.SORT_METHOD_STUDIO)
        xbmcplugin.addSortMethod(handle = self.addon_handle, sortMethod = xbmcplugin.SORT_METHOD_GENRE)

I want to add a new sort for 'issue_number'

It's possible to create a custom one?


RE: It's possible to set a "custom" SORT_METHOD? - jbinkley60 - 2022-12-15

(2022-12-15, 20:36)sagrath Wrote: I want to add a new sort for 'issue_number'

It's possible to create a custom one?

Is there a reason you can't use episode instead of issue_number and then you can use the standard xbmcplugin.SORT_METHOD_EPISODE sorting method ?  I don't believe you can define custom sort orders within an addon.  I personally use Mezzmo and similar techniques for that.


Jeff


RE: It's possible to set a "custom" SORT_METHOD? - sagrath - 2022-12-15

(2022-12-15, 20:48)jbinkley60 Wrote: Is there a reason you can't use episode instead of issue_number and then you can use the standard xbmcplugin.SORT_METHOD_EPISODE sorting method ?  I don't believe you can define custom sort orders within an addon.  I personally use Mezzmo and similar techniques for that.


No reason, I didn't think of using a method aimed at TVShows specifically. I'll try using SORT_METHOD_EPISODE. I believe it will work
Thanks in advance!