UPNP - Change sort method for TV Shows to Episode Number #783

Closed
wants to merge 6 commits into
from

5 participants

@ghost

If the path NodeType is NODE_TYPE_EPISODES sort by EPISODE number else
sort by Label (as default)

Plus, added to .gitignore files *~ (vi backup files)

Akelge UPNP - Sort TB Shows by Episode, else sort by Label
If the path NodeType is NODE_TYPE_EPISODES sort by EPISODE number else
sort by Label (as default)
a5929f1
@jhsrennie
Team Kodi member

I've already tried several suggestions for uPnP sorting, e.g. #626, but to no avail. I'm unconvinced we should be making ad hoc changes to the sorting. It needs someone to sit down and come up with comprehensive guidelines for sorting.

@ghost

As a good upnp client I can suggest UPNP Inspector (http://coherence.beebits.net/wiki/UPnP-Inspector). It is written in Python using Coherence UPNP framework. I use this to do tests, when I don't have my WDTV handy.

If I can tell, I think that some kind of basic sort, even if it is a hack, is better than ONE SINGLE sorting method. For TV Series it is really bad to see episodes ordered by episode title, when the natural order is by episode number.

The best thing IMHO would be to use the same sorting the user set in the GUI for that section, but I've no time to look deeply in XBMC code to come up with a nice solution. I'll work on it, but, in the meantime, if no one has objections, please include it.

@ghost

Tested right now on Music and the songs are ordered on title (LABEL for music file) that is awful. Now, I don't think that populating UPNP.cpp with a very long case is good. I'll try to discover how to read from GUI that seems to me the best solution (there are already all defaults and user can change ordering as he likes).

Comments?

@jmarshallnz
Team Kodi member

I should think it should be up to the client normally to do sorting, but at any rate, check out how CGUIViewState is used in CGUIMediaWindow.

@ghost
@jmarshallnz
Team Kodi member
@ghost

I've made some tests and seems to work. I know I have to squeeze the two patches, but previously I would like to know if it is good (I'm not very skilled in C++)

@ghost

More: using that patch, ordering of Containers in UPNP is the same that is set in GUI. That should be the best solution, so far. Well, the best one would be to use sorting criteria requested by client, if no sorting is asked, we should fall back to above patch, but, as I already wrote, I think that requesting sorting order is not implemented in many clients.

@elupus
Team Kodi member

I suppose i can live with the gui setting controlling the order. But it seem a bit silly.

@jmarshallnz
Team Kodi member

It seems to me that the best thing would be the default orderings that GUIViewState gives would apply, rather than whatever is set in the GUI. Currently we don't have an easy way to specify that as the defaults are overridden when the viewstate is loaded from the db. We could factor this out though if we want to use that method.

For most stuff it's sort by label. For songs it's sort by song number. For episodes it's sort by season/episode number.

As it turns out, with current master, sort by label should handle episodes, shows and movies just fine (as we set the label by default to "1x03. ep title". It looks like songs won't quite do what we want, though a fairly simple change similar to fec89e4 could be used in CMusicDatabase::FileItemFromDataset. I'm not sure what would make most sense though - it would depend somewhat on how the client generated the listing (if it's a search then something like artist - album - song might make sense, if it's an album listing then disk/track/song would make sense).

@ghost

If I understood correctly the code, GUIViewState already has defaults for everything, so, if user did not set a particular Sorting key in GUI, we have defaults anyway and CGUIViewState should use them.

This seems to me the best approach: if users do not touch anything, we use default ordering, if users set their personal sorting method, we use that, even for Music or for Searches (anyway I checked and searches are not managed by now, searching for a particular title has no effect and UPnP Server returns all items, should work on this).

I don't like the idea of changing Episode label to include episode number: Episode Number is one thing, Episode title is another one.

Akelge added some commits Mar 19, 2012
@elupus
Team Kodi member

Drop the commented out code and rebase on master + squash to one commit. I still ponder if i like that display settings in xbmc will affect how upnp items are served, it will confuse a lot of people and make handling bug reports much harder.

@ghost

Sorry, but I'm really unable to use git/github. The above patch is the best I can do. Hope someone would help and rebase/squash it in the correct way (removing unneded UPNP.cpp~ file)

A.

@alcoheca

hi, I'm working on UPnP improvements in XBMC as part of GSoC. I'm about to look at the sorting issues. I think we should keep things as simple as possible, so in that case

  • if sort_criteria is specified, apply that
  • else, sort by the default method for that particular media type.

Im not sure applying profile/user specific choice of sorting method to the server is a good idea whatsoever. If the client wants to apply a different sort method then that's all well and good, it can either request it or re-sort on receipt of item list using metadata.

you can follow progress in my fork of xbmc here

NB: on my testing of a few different UPnP clients (including XBMC), none of them specify a sort criteria.

@ghost
@alcoheca

What I mean if sort criteria is not specified by the control point, we sort according to the GUIViewState defaults - NOT according to what a particular xbmc profile has set. That way, the behaviour is deterministic.

@ghost
@MartijnKaijser
Team Kodi member

@alcoheca
Still needed after your upnp improvements?

@alcoheca

Ah I forgot about this one, no its done and committed.

@alcoheca alcoheca closed this Oct 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment