1 From c8245740c3a8699cfe7d7e5aa0d427b931018ad5 Mon Sep 17 00:00:00 2001
2 From: Yusuke Yanbe <y.yanbe@gmail.com>
3 Date: Mon, 4 Jul 2016 08:20:46 +0900
4 Subject: [PATCH] Add support for grouping videos by directory for Panasonic
8 upnpsoap.c | 24 +++++++++++++++++++-----
10 2 files changed, 23 insertions(+), 6 deletions(-)
14 @@ -1095,6 +1095,15 @@ callback(void *args, int argc, char **ar
15 add_res(size, duration, bitrate, sampleFrequency, nrAudioChannels,
16 resolution, dlna_buf, mime, detailID, ext, passed_args);
19 + DPRINTF(E_DEBUG, L_HTTP, "Title: %s - %d Returned / %d childCount\n",
20 + title, passed_args->returned, passed_args->childCount);
22 + ret = strcatf(str, "<pxn:groupTopFlag>%d</pxn:groupTopFlag>"
23 + "<pxn:groupID>%s</pxn:groupID>"
24 + "<pxn:groupTitle>%s</pxn:groupTitle>"
25 + "<pxn:groupMemberNum>%d</pxn:groupMemberNum>",
26 + passed_args->returned == passed_args->childCount, parent, passed_args->parentTitle, passed_args->childCount);
28 case ESamsungSeriesCDE:
30 @@ -1357,8 +1366,11 @@ BrowseContentDirectory(struct upnphttp *
32 sqlite3_snprintf(sizeof(where), where, "PARENT_ID = '%q'", ObjectID);
35 + if (!totalMatches) {
36 totalMatches = get_child_count(ObjectID, magic);
37 + args.childCount = totalMatches;
38 + args.parentTitle = sql_get_text_field(db, "SELECT d.TITLE FROM OBJECTS o LEFT JOIN DETAILS d ON (d.ID = o.DETAIL_ID) WHERE OBJECT_ID='%q'", ObjectID);
41 if (SortCriteria && !orderBy)
43 @@ -1397,14 +1409,16 @@ BrowseContentDirectory(struct upnphttp *
44 SoapError(h, 709, "Unsupported or invalid sort criteria");
48 sql = sqlite3_mprintf("SELECT %s, %s, %s, " COLUMNS
49 "from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)"
50 - " where %s %s limit %d, %d;",
51 + " where %s order by d.date limit %d, %d;",
52 objectid_sql, parentid_sql, refid_sql,
53 - where, THISORNUL(orderBy), StartingIndex, RequestedCount);
54 + where, StartingIndex, RequestedCount);
55 DPRINTF(E_DEBUG, L_HTTP, "Browse SQL: %s\n", sql);
56 ret = sqlite3_exec(db, sql, callback, (void *) &args, &zErrMsg);
57 + if (args.parentTitle) {
58 + sqlite3_free(args.parentTitle);
61 if( (ret != SQLITE_OK) && (zErrMsg != NULL) )
63 @@ -1838,7 +1852,7 @@ SearchContentDirectory(struct upnphttp *
64 (*ContainerID == '*') ? NULL :
65 sqlite3_mprintf("UNION ALL " SELECT_COLUMNS
66 "from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)"
67 - " where OBJECT_ID = '%q' and (%s) ", ContainerID, where),
68 + " where OBJECT_ID = '%q' and (%s) ORDER BY d.date", ContainerID, where),
69 orderBy, StartingIndex, RequestedCount);
70 DPRINTF(E_DEBUG, L_HTTP, "Search SQL: %s\n", sql);
71 ret = sqlite3_exec(db, sql, callback, (void *) &args, &zErrMsg);
75 #define CONTENT_DIRECTORY_SCHEMAS \
76 " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" \
77 " xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\"" \
78 - " xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\""
79 + " xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"" \
80 + " xmlns:pxn=\"urn:schemas-panasonic-com:pxn\""
81 #define DLNA_NAMESPACE \
82 " xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\""
83 #define PV_NAMESPACE \
84 @@ -39,6 +40,8 @@ struct Response