1 From c6d2a53c63a065a974c3f8fd1df29c30c2e2b40a Mon Sep 17 00:00:00 2001
2 From: Alasdair Campbell <alcoheca@gmail.com>
3 Date: Fri, 26 Oct 2012 12:57:58 +0100
4 Subject: [PATCH 15/24] platinum: fix missing filtering for extra metadata
7 lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp | 6 ++++++
8 lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h | 7 +++++++
9 lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp | 6 +++---
10 3 files changed, 16 insertions(+), 3 deletions(-)
12 diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
13 index 6f72dda..73f9ed2 100644
14 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
15 +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
16 @@ -111,6 +111,12 @@ PLT_Didl::ConvertFilterToMask(const NPT_String& filter)
17 mask |= PLT_FILTER_MASK_LONGDESCRIPTION;
18 } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_ORIGINALTRACK, len, true) == 0) {
19 mask |= PLT_FILTER_MASK_ORIGINALTRACK;
20 + } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPOSITION, len, true) == 0) {
21 + mask |= PLT_FILTER_MASK_LASTPOSITION;
22 + } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPLAYBACK, len, true) == 0) {
23 + mask |= PLT_FILTER_MASK_LASTPLAYBACK;
24 + } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_PLAYCOUNT, len, true) == 0) {
25 + mask |= PLT_FILTER_MASK_PLAYCOUNT;
26 } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_SEARCHABLE, len, true) == 0) {
27 mask |= PLT_FILTER_MASK_SEARCHABLE;
28 } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_SEARCHCLASS, len, true) == 0) {
29 diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
30 index 29ce9ca..9af9725 100644
31 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
32 +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
34 #define PLT_FILTER_MASK_SEARCHCLASS 0x0000000040000000
35 #define PLT_FILTER_MASK_REFID 0x0000000080000000
37 +#define PLT_FILTER_MASK_LASTPOSITION 0x0000000100000000
38 +#define PLT_FILTER_MASK_LASTPLAYBACK 0x0000000200000000
39 +#define PLT_FILTER_MASK_PLAYCOUNT 0x0000000400000000
41 #define PLT_FILTER_FIELD_TITLE "dc:title"
42 #define PLT_FILTER_FIELD_CREATOR "dc:creator"
43 #define PLT_FILTER_FIELD_DATE "dc:date"
45 #define PLT_FILTER_FIELD_PROGRAMTITLE "upnp:programTitle"
46 #define PLT_FILTER_FIELD_SERIESTITLE "upnp:seriesTitle"
47 #define PLT_FILTER_FIELD_EPISODE "upnp:episodeNumber"
48 +#define PLT_FILTER_FIELD_LASTPOSITION "upnp:lastPlaybackPosition"
49 +#define PLT_FILTER_FIELD_LASTPLAYBACK "upnp:lastPlaybackTime"
50 +#define PLT_FILTER_FIELD_PLAYCOUNT "upnp:playbackCount"
51 #define PLT_FILTER_FIELD_SEARCHCLASS "upnp:searchClass"
52 #define PLT_FILTER_FIELD_SEARCHABLE "@searchable"
53 #define PLT_FILTER_FIELD_CHILDCOUNT "@childcount"
54 diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
55 index 31bc16c..af6bc3b 100644
56 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
57 +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
58 @@ -333,21 +333,21 @@ PLT_MediaObject::ToDidl(NPT_UInt64 mask, NPT_String& didl)
61 // last playback position
62 - if (m_MiscInfo.last_position > 0) {
63 + if (mask & PLT_FILTER_MASK_LASTPOSITION && m_MiscInfo.last_position > 0) {
64 didl += "<upnp:lastPlaybackPosition>";
65 didl += NPT_String::FromInteger(m_MiscInfo.last_position);
66 didl += "</upnp:lastPlaybackPosition>";
69 // last playback datetime
70 - if (!m_MiscInfo.last_time.IsEmpty()) {
71 + if (mask & PLT_FILTER_MASK_LASTPLAYBACK && !m_MiscInfo.last_time.IsEmpty()) {
72 didl += "<upnp:lastPlaybackTime>";
73 PLT_Didl::AppendXmlEscape(didl, m_MiscInfo.last_time);
74 didl += "</upnp:lastPlaybackTime>";
78 - if (m_MiscInfo.play_count > -1) {
79 + if (mask & PLT_FILTER_MASK_PLAYCOUNT && m_MiscInfo.play_count > -1) {
80 didl += "<upnp:playbackCount>";
81 didl += NPT_String::FromInteger(m_MiscInfo.play_count);
82 didl += "</upnp:playbackCount>";