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)
UPNP - Sort TB Shows by Episode, else sort by Label
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.
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.
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).
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.
Use CGUIViewState for ordering of UPNP Containers
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++)
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.
I suppose i can live with the gui setting controlling the order. But it seem a bit silly.
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).
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.
Merge branch 'master' of https://github.com/akelge/xbmc
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.
Delete commented code
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)
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
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.
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.
Still needed after your upnp improvements?
Ah I forgot about this one, no its done and committed.