Jump to content

Movies in Collections are not sorted by "SortName"


Tolotos

Recommended Posts

Tolotos

Hi,

I'm using the Aeon Nox 5 MB skin. If I enter a collection folder the content is ordered by the Title and not the SortName. Is this a skin issue or a plugin issue?

Yours Tolotos

 

Link to comment
Share on other sites

xnappo

Plugin issue.  

 

I need some help here.  Here is what the code looks like, it is pretty simple:

        if item.get("Type") == "Episode" and db.get("allowSort") != "false":
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_EPISODE)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_GENRE)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
        elif item.get("Type") != "Audio" and db.get("allowSort") != "false":
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_GENRE)
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)        
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_DATE)                
        else:
            xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_NONE)   

Unfortunately BoxSets are a bit nasty to handle, because it is hard to tell how we got into them.

 

I made a mod such that if you go in through the BoxSet or Collection node, it works right - however it is not going to work if you go into a boxset from the full movie view.

 

Unless someone has a better idea, I am inclined to make server or client side sorting an option, and let the user decide which problems to live with.  As a reminder - the server side sorting breaks jumping through the movie list with a remote/keyboard and the first letter ('the' conflicts).

 

xnappo

Link to comment
Share on other sites

for boxsets the best thing to do is avoid client-side sorting so that user-defined settings can work as expected. the metadata manager has a sort setting that can be chosen individually for each boxset.

Link to comment
Share on other sites

xnappo

I am moving ahead with making using Kodi sorting(set via side menu) or Mediabrowser sever sorting(set via context menu) an option.  Default is server sorting.

 

It is in the Git - will push to beta when all three 'in progress' issues I am working on are closed.

 

xnappo

Link to comment
Share on other sites

puithove

Hmmm... that's a bummer to have to do it that way.  I can confirm that changing the addon option for Kodi sort changes the behavior of the sorting in the boxsets.

 

On a different note - not sure if it's related to the changes you've done, but I now notice that in the movies list if I have "Add item and played counts" enabled (which I like to have) each movie listing has (0/0) added to the title, instead of just collection items.

Edited by puithove
Link to comment
Share on other sites

xnappo

I still don't like the solution :)

 

@@Luke - is there a POST command to change the sorting option for a section on the server?

 

xnappo

Link to comment
Share on other sites

xnappo

@@Luke - right now, I am doing something horrible, which can't be what is intended.  I have a query like this:

 

blahblah&SortBy=SortName&blahblah

 

If the user decides they want to sort by year, I use a regexp to change that to:

&blahblah&Sortby=Year,SortName&blahblah

refresh listing

 

Then I do a bunch of junk saving what the preferred sort is for that particular folder/view client side.

 

It would be much better if the server kept track of what the user's desired sort was for a particular folder/view, and an API call was available to change that default.  So instead it would look like this:

POST id : sort=Year

refresh

 

xnappo

Edited by xnappo
  • Like 1
Link to comment
Share on other sites

What you are asking for does exist.  It is called DisplayPreferences and it is what MBC uses.  All the prefs are stored at the server level so that, no matter what instance of MBC a user is on, his prefs are carried across.

 

These prefs are stored by a DisplayPrefsId which should be calculated based on the type of item involved.  For instance, all TV Series folders share the same DisplayPrefsID but generic folders have their own.

 

Look at Swagger.  There is a get and a post so that the client can both read and update the preferences.  All the normal things are defined in the object but there is also a key/value pair structure that you can store whatever you want in.

  • Like 1
Link to comment
Share on other sites

xnappo

Excellent.  Thanks ebr - will take a look at implementing this way - sounds much better!

 

@ - if you are bored feel free to beat me to it, going out of town this w/e so don't know when I will get to it.

 

xnappo

Link to comment
Share on other sites

xnappo

@@ebr - now that I look at this more, it seems more like just a way to store what we are storing locally on the server.  You are still using this information to change the server queries based on what in stored there right?  It does not change the actual result from a query without 'SortBy' in the get request?

 

Still useful, but slightly different from what I was looking for.

 

xnappo

Edited by xnappo
Link to comment
Share on other sites

Yes, it is just storage of the preference values tied to client/user/folder.  MBC handles all sorting client side (because it was already built in).  But, I believe MBT uses this same interface for display preferences and just modifies the queries sent based on the options.

 

If you build your queries using the model objects, this should be pretty straightforward.

Link to comment
Share on other sites

xnappo

Yeah, it isn't too bad - just not sure it is worth moving just for storage of the sort options.

 

@ @@im85288 - thoughts?  We could store the preferred views using this thing too if we wanted..

Link to comment
Share on other sites

By using the facility of the server, a user's preferences travel with them no matter which instance of your app they use.  That is the benefit to using those.

 

Whether or not you handle sorting client side or via queries I guess comes down to whether the API gives you all the sorting options the users expect and/or whether or not the sorting is ingrained in the current implementation.

 

Also, sorting client side requires that the entire data set be on the client.  With MBC this was already an assumption everywhere so leaving the sorting client side was the best thing to do.  But, if Kodi does not already assume that the entire data set is there, then it would be better to use server-side sorting and allow paging of the result set to increase performance.

Link to comment
Share on other sites

xnappo

Hi ebr - yes we understand.  There are really four levels here:

	Sorting Operation	Preference Storage	Sort Request	Advantage
1	Client			Client			Client		Client-specific features
2	Server			Client			Client		Consistent sorting between clients
3	Server			Server			Client		Persistant sorting between clients
4	Server			Server			Server		Consistent interpretation of requests, cleaner code

We cover 1 & 2 right now.  3 is nice and we will play with it, but we were looking for 4 - where we don't have to include 'SortBy' at all in the request and the server knows what the users wants.

 

xnappo

Edited by xnappo
Link to comment
Share on other sites

Oh, okay.  I don't think 4 necessarily makes sense because the sort can very well be contextual to the presentation in the client.  So, IMO, 3 is as far as it will go.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...