GNOME Bugzilla – Bug 694357
Incorrect behaviour when sorting by Date and TrackNumber
Last modified: 2013-07-23 15:18:53 UTC
This is a little obscure I realise, but I'm experiencing some strange behaviour using the sort facility of the Search command with Media Export. The items returned using the sort criteria "+dc:date,+upnp:originalTrackNumber" are not sorted correctly. If I just sort by date using dLeyna's mediaconsole I get root.search('Type derivedfrom "item"',0,0,['Date'],"+Date") Total Items: 31 { "Date": "2010" } { "Date": "2013-02-20T08:28:32Z" } { "Date": "2013-02-20T08:28:44Z" } { "Date": "2013-02-20T08:28:56Z" } { "Date": "2013-02-20T08:29:01Z" } { "Date": "2013-02-20T08:29:22Z" } { "Date": "2013-02-20T08:29:34Z" } { "Date": "2013-02-20T12:24:09Z" } { "Date": "2013-02-20T12:24:15Z" } { "Date": "2013-02-20T12:24:20Z" } { "Date": "2013-02-20T12:24:42Z" } { "Date": "2013-02-20T12:24:48Z" } { "Date": "2013-02-20T12:24:54Z" } { "Date": "2013-02-20T13:04:38Z" } { "Date": "2013-02-20T13:04:43Z" } { "Date": "2013-02-20T13:04:50Z" } { "Date": "2013-02-20T13:05:10Z" } { "Date": "2013-02-20T13:05:15Z" } { "Date": "2013-02-20T13:05:22Z" } { "Date": "2013-02-20T13:05:47Z" } { "Date": "2013-02-20T13:05:53Z" } { "Date": "2013-02-20T13:05:59Z" } { "Date": "2013-02-20T13:07:42Z" } { "Date": "2013-02-20T13:07:49Z" } { "Date": "2013-02-20T13:07:55Z" } { "Date": "2013-02-20T13:09:12Z" } { "Date": "2013-02-20T13:09:19Z" } { "Date": "2013-02-20T13:09:25Z" } { "Date": "2013-02-20T13:12:29Z" } { "Date": "2013-02-20T13:12:36Z" } { "Date": "2013-02-20T13:12:42Z" } But if I sort by Date and TrackNumber I get root.search('Type derivedfrom "item"',0,0,['Date'],"+Date,+TrackNumber") Total Items: 31 { "Date": "2010" } { "Date": "2013-02-20T12:24:09Z" } { "Date": "2013-02-20T12:24:15Z" } { "Date": "2013-02-20T12:24:20Z" } { "Date": "2013-02-20T12:24:42Z" } { "Date": "2013-02-20T12:24:48Z" } { "Date": "2013-02-20T12:24:54Z" } { "Date": "2013-02-20T13:04:38Z" } { "Date": "2013-02-20T13:04:43Z" } { "Date": "2013-02-20T13:04:50Z" } { "Date": "2013-02-20T13:05:10Z" } { "Date": "2013-02-20T13:05:15Z" } { "Date": "2013-02-20T13:05:22Z" } { "Date": "2013-02-20T13:05:47Z" } { "Date": "2013-02-20T13:05:53Z" } { "Date": "2013-02-20T13:05:59Z" } { "Date": "2013-02-20T13:07:42Z" } { "Date": "2013-02-20T13:07:49Z" } { "Date": "2013-02-20T13:07:55Z" } { "Date": "2013-02-20T13:09:12Z" } { "Date": "2013-02-20T13:09:19Z" } { "Date": "2013-02-20T13:09:25Z" } { "Date": "2013-02-20T13:12:29Z" } { "Date": "2013-02-20T13:12:36Z" } { "Date": "2013-02-20T13:12:42Z" } { "Date": "2013-02-20T08:28:32Z" } { "Date": "2013-02-20T08:28:44Z" } { "Date": "2013-02-20T08:28:56Z" } { "Date": "2013-02-20T08:29:01Z" } { "Date": "2013-02-20T08:29:22Z" } { "Date": "2013-02-20T08:29:34Z" } Since no two dates are the same the results of both searches should be identical. I also get a similar result with UPnP Inspector. I can post the resulting DIDL documents if needed.
A quick update, I encountered the same problem with "+dc:date,dc:title".
That should of course be "+dc:date,+dc:title".
I suppose this is with MediaExport?
Yes. This is with MediaExport. I didn't test the Tracker plugin I'm afraid.
sorting is done by the back-end, hence the question.
oops, by accident I saw the translation of the sort criteria: ORDER BY strftime("%Y", m.date) ASC ,o.title COLLATE CASEFOLD ASC This should explain the order issues.
Created attachment 243995 [details] [review] media-export: Fix sorting by date
This was fixed in 0.18.2 and 0.19.2
Attachment 243995 [details] pushed as 0380882 - media-export: Fix sorting by date