Would it be possible to change the sorting of lists individually?
And would it be possible to filter lists? In order to:
I realise that this may be a lot of work or even a bit of a long shot, but I think these features would be a great addition to the party!
Would it be possible to change the sorting of lists individually?
In the addon browser it is. I've added a couple of sorting methods (Default, Title, Last Played, Play Count) on latest. The other sorting methods available either don't work correctly (Date was just sorting randomly!) or don't make sense because the details are only available for previously cached items (e.g. sort by MPAA or Duration makes a mess because only some items will have those details).
For widgets, sorting should be handled by the skin and it is up to the skinner to allow sort methods for widgets.
hide/unhide watched items in some widgets but not others
I can't really see any non-convoluted way for users to signal which widgets they would want to hide watched in. Really these types of things should be done from the Kodi / Skin side of things. You can hide watched when browsing the addon - really Kodi core needs to expose this ability for dynamic lists so that skins can provide options for individual widgets.
For widgets, sorting should be handled by the skin and it is up to the skinner to allow sort methods for widgets.
Really these types of things should be done from the Kodi / Skin side of things.
My understanding is the same as yours with library content, but for addon content, the skin can only sort the the first page i.e. the first 10/20 items in the list - essentially only sorting the top 10 results of an already sorted list, as opposed to sorting the whole list.
What if there was a sort option within the settings for each list in question, that when changed, appends the relevant sort_by string to the api query for that list? Much like you would've done for the "extend Trakt lists to 20 items" option.
And then the same type of thing for filtering watched items out of lists - although this would admittedly require extra Trakt API requests for items in TMDb lists.
If I knew how to test the TMDb and Trakt API's I would have a crack at trying to generate some of the queries myself.
@tjamieg - Ah, I see what you are getting at. Try out the Discover method of the plugin - that will allow you to create a variety of rules, including sorting methods.
You can read about the APIs here:
https://developers.themoviedb.org/3
https://trakt.docs.apiary.io
As you can see here, endpoints such as Popular Movies don't allow sort methods. The only params allowed are apikey, language, page, and region.
Anyway, sorting lists defeats the purpose of the list. For instance, Popular Movies is just all movies sorted by popularity score - if you sorted it any other way then it wouldn't be popular movies any more... Plus, Discover is really powerful and you can make as many widgets with it as you like.
You can read about the APIs here:
https://developers.themoviedb.org/3
https://trakt.docs.apiary.ioAs you can see here, endpoints such as Popular Movies don't allow sort methods. The only params allowed are apikey, language, page, and region.
Thank you, I have looked at Trakt's API documentation briefly before, but wasn't sure how to get Apiary's console working so I could test my own queries. Every time I stuck my Trakt API key in I got a "405 response".
Anyway, sorting lists defeats the purpose of the list. For instance, Popular Movies is just all movies sorted by popularity score - if you sorted it any other way then it wouldn't be popular movies any more... Plus, Discover is really powerful and you can make as many widgets with it as you like.
Yeah I get you, I kinda realised how silly this sounded as I was typing it! That being said, I think addiing a sort option in this way can still be useful for limited user lists (like Watchlist, Trakt Lists, Recently Watched, Recommended etc).
For example, currently, both my Watchlist and Gilad & Alex's Latest Releases lists on Trakt appear to be sorted by rank in TMDb Helper widgets, when ideally there would be an option to sort each of these by recently added/popularity/votes/random etc. like you can on the Trakt website.
Or maybe the watchlist could even inherit it's sort option from Trakt?
For example, currently, both my Watchlist and Gilad & Alex's Latest Releases lists on Trakt appear to be sorted by rank in TMDb Helper widgets, when ideally there would be an option to sort each of these by recently added/popularity/votes/random etc. like you can on the Trakt website.
I agree that this type of sorting for lists would be nice to have. The problem is that without Trakt api exposing a sort method, it would need to be done in the plugin itself. To do that I would need to retrieve 100s of items from trakt and then sort them. That would be fine if Trakt supplied artwork links and metadata, but it doesn't. So I need to look-up each item individually. That means I need to paginate the results, otherwise it would take forever.
Each "page" of the plugin is actually it's own instance. When you click next page, it really is just a completely separate plugin path with a param indicating the page number. Kodi calls the new path and the plugin makes a request for that page number from the API. What that means is that two different "pages" can't share any information between them (other than what is passed in the path url). So I would need to repeat this process of retrieving 100+ items, sorting, paginating, and looking up details for every single page. It just isn't feasible from a performance perspective.
Or maybe the watchlist could even inherit it's sort option from Trakt?
I think Watchlist has a sort option. But that's the only Trakt list that I can see that allows sorting methods. I can add an option for Watchlist sort.
@tjamieg - Okay, please test latest version. You can now choose watchlist sorting method in the plugin settings under Accounts. Available options are rank title released added
Watchlist sorting tested and working brilliantly!
Thinking about a way around doing it for user lists, I found this in the Trakt API docs:

Now it'll probably make a lot more sense to you than it does to me, but from what I can gather you'd need a way to set the X-Sort-By and X-Sort-How variables in the addon's header, as opposed to appending a {sortmethod} parameter to the API query's path.
If this is too awkard to do from the addon's settings, could the header variables come from editing the widget path instead? Which would look something like:
plugin://plugin.video.themoviedb.helper/?info=trakt_userlist&type=movie&widget=True&list_slug=latest-releases&user_slug=giladg
With the following added on: &sort_by=added&sort_how=desc
@tjamieg Unfortunately, what you're referring to are actually parameters that are sent back from Trakt, and indicate how the list is sorted on the website. You can't send them as headers in order to get the lists sorted to your liking 馃槬
Yep, what @drinfernoo said unfortunately... 馃槥
Can you not add sort methods via xbmcplugin and have them work?
Can you not add sort methods via
xbmcpluginand have them work?
Yeah, I already added those. See comment here: https://github.com/jurialmunkey/plugin.video.themoviedb.helper/issues/63#issuecomment-578594481
For some reason, date doesn't work correctly and was sorting randomly. Others aren't great due to the way I only fill detailed info if it's cached - e.g. MPAA or Runtime - so I didn't add those. I added Default, Title, Last Played, Play Count, as those seem to work fairly consistently.
Still, those will only sort the current page - It's sorting for the whole list that we're looking for here.