aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Campbell <alcoheca@gmail.com>2012-10-06 23:35:52 +0100
committerAlasdair Campbell <alcoheca@gmail.com>2012-10-11 02:26:29 +0100
commite2f1b7ae2ede609c590ca492b0196317080fc866 (patch)
tree1579372673b333fcb5150ff9acf8f3886bcb943d
parentcd59b5e0061d60048a3e0bc7cf4c867049fb0520 (diff)
[UPnP] support video ratings
-rw-r--r--lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h8
-rw-r--r--lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp8
-rw-r--r--xbmc/network/upnp/UPnPInternal.cpp2
3 files changed, 15 insertions, 3 deletions
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
index c50d450913..8d9704ffb6 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h
@@ -80,10 +80,11 @@
#define PLT_FILTER_MASK_LONGDESCRIPTION 0x04000000
#define PLT_FILTER_MASK_ICON 0x08000000
+#define PLT_FILTER_MASK_RATING 0x10000000
-#define PLT_FILTER_MASK_TOC 0x10000000
-#define PLT_FILTER_MASK_SEARCHCLASS 0x20000000
-#define PLT_FILTER_MASK_REFID 0x40000000
+#define PLT_FILTER_MASK_TOC 0x20000000
+#define PLT_FILTER_MASK_SEARCHCLASS 0x40000000
+#define PLT_FILTER_MASK_REFID 0x80000000
#define PLT_FILTER_FIELD_TITLE "dc:title"
#define PLT_FILTER_FIELD_CREATOR "dc:creator"
@@ -99,6 +100,7 @@
#define PLT_FILTER_FIELD_DESCRIPTION "dc:description"
#define PLT_FILTER_FIELD_LONGDESCRIPTION "upnp:longDescription"
#define PLT_FILTER_FIELD_ICON "upnp:icon"
+#define PLT_FILTER_FIELD_RATING "upnp:rating"
#define PLT_FILTER_FIELD_ORIGINALTRACK "upnp:originalTrackNumber"
#define PLT_FILTER_FIELD_PROGRAMTITLE "upnp:programTitle"
#define PLT_FILTER_FIELD_SERIESTITLE "upnp:seriesTitle"
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
index 64437d21fd..0a55eef8e7 100644
--- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
+++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp
@@ -318,6 +318,13 @@ PLT_MediaObject::ToDidl(NPT_UInt32 mask, NPT_String& didl)
didl += "</upnp:icon>";
}
+ // rating
+ if ((mask & PLT_FILTER_MASK_RATING) && !m_Description.rating.IsEmpty()) {
+ didl += "<upnp:rating>";
+ PLT_Didl::AppendXmlEscape(didl, m_Description.rating);
+ didl += "</upnp:rating>";
+ }
+
// original track number
if ((mask & PLT_FILTER_MASK_ORIGINALTRACK) && m_MiscInfo.original_track_number > 0) {
didl += "<upnp:originalTrackNumber>";
@@ -529,6 +536,7 @@ PLT_MediaObject::FromDidl(NPT_XmlElementNode* entry)
PLT_XmlHelper::GetChildText(entry, "description", m_Description.description, didl_namespace_dc);
PLT_XmlHelper::GetChildText(entry, "longDescription", m_Description.long_description, didl_namespace_upnp);
PLT_XmlHelper::GetChildText(entry, "icon", m_Description.icon_uri, didl_namespace_upnp);
+ PLT_XmlHelper::GetChildText(entry, "rating", m_Description.rating, didl_namespace_upnp);
PLT_XmlHelper::GetChildText(entry, "toc", m_MiscInfo.toc, didl_namespace_upnp);
// album arts
diff --git a/xbmc/network/upnp/UPnPInternal.cpp b/xbmc/network/upnp/UPnPInternal.cpp
index bc033394bd..1b798f15dd 100644
--- a/xbmc/network/upnp/UPnPInternal.cpp
+++ b/xbmc/network/upnp/UPnPInternal.cpp
@@ -280,6 +280,7 @@ PopulateObjectFromTag(CVideoInfoTag& tag,
object.m_Description.description = tag.m_strTagLine;
object.m_Description.long_description = tag.m_strPlot;
+ object.m_Description.rating = tag.m_strMPAARating;
object.m_MiscInfo.last_position = tag.m_resumePoint.timeInSeconds;
object.m_MiscInfo.last_time = tag.m_lastPlayed.GetAsLocalizedDate();
object.m_MiscInfo.play_count = tag.m_playCount;
@@ -650,6 +651,7 @@ PopulateTagFromObject(CVideoInfoTag& tag,
tag.m_writingCredits.push_back(object.m_People.authors.GetItem(index)->name.GetChars());
tag.m_strTagLine = object.m_Description.description;
tag.m_strPlot = object.m_Description.long_description;
+ tag.m_strMPAARating = object.m_Description.rating;
tag.m_strShowTitle = object.m_Recorded.series_title;
tag.m_lastPlayed.SetFromDateString((const char*)object.m_MiscInfo.last_time);
tag.m_playCount = object.m_MiscInfo.play_count;