From b94f04d6ef5b9532088fadb9a874d5317d519495 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 29 Jul 2015 23:58:21 -0700 Subject: [PATCH] upnpsoap: Work around LG TV ordering bug. From SF Patch #90: My LG TV (42LE5500) retrieves items from BrowseDirectChildren in a weird way. The TV can only display up to 20 items per page, but it sets RequestedCount to 54. StartingIndex is correctly set to 0, 20, 40, ... etc. When minidlna responds with the 54 entries, the TV sorts folders (containers) first, before items, then displays the entries, limited to 20 per page. In my setup, I have ~23 folders whose names are similar to the files, so that when sorting by name, the folders are mixed with the files, thereby resulting in duplicate folders appearing on all 3 pages and many missing files. The solution is to make sure minidlna orders items the same way that the TV expects them, so that when the StartingIndex is 20 or more, we return the "correct" subset of items. Thanks SF user Darell Tan for the fix. --- upnpsoap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upnpsoap.c b/upnpsoap.c index 77fc468..aa6eb81 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -1332,6 +1332,9 @@ BrowseContentDirectory(struct upnphttp * h, const char * action) __SORT_LIMIT ret = xasprintf(&orderBy, "order by o.CLASS, d.DISC, d.TRACK, d.TITLE"); } + /* LG TV ordering bug */ + else if( args.client == ELGDevice ) + ret = xasprintf(&orderBy, "order by o.CLASS, d.TITLE"); else orderBy = parse_sort_criteria(SortCriteria, &ret); if( ret == -1 )