summaryrefslogtreecommitdiffstats
path: root/lib/libUPnP/patches/0015-platinum-fix-missing-filtering-for-extra-metadata.patch
blob: ad8e0b1ff1b8a673f4bed6c0383042fa4d8afd34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From c6d2a53c63a065a974c3f8fd1df29c30c2e2b40a Mon Sep 17 00:00:00 2001
From: Alasdair Campbell <alcoheca@gmail.com>
Date: Fri, 26 Oct 2012 12:57:58 +0100
Subject: [PATCH 15/24] platinum: fix missing filtering for extra metadata

---
 lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp      | 6 ++++++
 lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h        | 7 +++++++
 lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp | 6 +++---
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
index 6f72dda..73f9ed2 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.cpp
@@ -111,6 +111,12 @@ PLT_Didl::ConvertFilterToMask(const NPT_String& filter)
             mask |= PLT_FILTER_MASK_LONGDESCRIPTION;
         } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_ORIGINALTRACK, len, true) == 0) {
             mask |= PLT_FILTER_MASK_ORIGINALTRACK;
+        } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPOSITION, len, true) == 0) {
+            mask |= PLT_FILTER_MASK_LASTPOSITION;
+        } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_LASTPLAYBACK, len, true) == 0) {
+            mask |= PLT_FILTER_MASK_LASTPLAYBACK;
+        } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_PLAYCOUNT, len, true) == 0) {
+            mask |= PLT_FILTER_MASK_PLAYCOUNT;
         } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_SEARCHABLE, len, true) == 0) {
             mask |= PLT_FILTER_MASK_SEARCHABLE;
         } else if (NPT_String::CompareN(s+i, PLT_FILTER_FIELD_SEARCHCLASS, len, true) == 0) {
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
index 29ce9ca..9af9725 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
@@ -86,6 +86,10 @@
 #define PLT_FILTER_MASK_SEARCHCLASS                 0x0000000040000000
 #define PLT_FILTER_MASK_REFID                       0x0000000080000000
 
+#define PLT_FILTER_MASK_LASTPOSITION                0x0000000100000000
+#define PLT_FILTER_MASK_LASTPLAYBACK                0x0000000200000000
+#define PLT_FILTER_MASK_PLAYCOUNT                   0x0000000400000000
+
 #define PLT_FILTER_FIELD_TITLE                      "dc:title"
 #define PLT_FILTER_FIELD_CREATOR                    "dc:creator"
 #define PLT_FILTER_FIELD_DATE                       "dc:date"
@@ -105,6 +109,9 @@
 #define PLT_FILTER_FIELD_PROGRAMTITLE               "upnp:programTitle"
 #define PLT_FILTER_FIELD_SERIESTITLE                "upnp:seriesTitle"
 #define PLT_FILTER_FIELD_EPISODE                    "upnp:episodeNumber"
+#define PLT_FILTER_FIELD_LASTPOSITION               "upnp:lastPlaybackPosition"
+#define PLT_FILTER_FIELD_LASTPLAYBACK               "upnp:lastPlaybackTime"
+#define PLT_FILTER_FIELD_PLAYCOUNT                  "upnp:playbackCount"
 #define PLT_FILTER_FIELD_SEARCHCLASS				"upnp:searchClass"
 #define PLT_FILTER_FIELD_SEARCHABLE                 "@searchable"
 #define PLT_FILTER_FIELD_CHILDCOUNT                 "@childcount"
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
index 31bc16c..af6bc3b 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
@@ -333,21 +333,21 @@ PLT_MediaObject::ToDidl(NPT_UInt64 mask, NPT_String& didl)
     }
 
     // last playback position
-    if (m_MiscInfo.last_position > 0) {
+    if (mask & PLT_FILTER_MASK_LASTPOSITION && m_MiscInfo.last_position > 0) {
         didl += "<upnp:lastPlaybackPosition>";
         didl += NPT_String::FromInteger(m_MiscInfo.last_position);
         didl += "</upnp:lastPlaybackPosition>";
     }
 
     // last playback datetime
-    if (!m_MiscInfo.last_time.IsEmpty()) {
+    if (mask & PLT_FILTER_MASK_LASTPLAYBACK && !m_MiscInfo.last_time.IsEmpty()) {
         didl += "<upnp:lastPlaybackTime>";
         PLT_Didl::AppendXmlEscape(didl, m_MiscInfo.last_time);
         didl += "</upnp:lastPlaybackTime>";
     }
 
     // playcount
-    if (m_MiscInfo.play_count > -1) {
+    if (mask & PLT_FILTER_MASK_PLAYCOUNT && m_MiscInfo.play_count > -1) {
         didl += "<upnp:playbackCount>";
         didl += NPT_String::FromInteger(m_MiscInfo.play_count);
         didl += "</upnp:playbackCount>";
-- 
1.7.11.msysgit.0