From cd59b5e0061d60048a3e0bc7cf4c867049fb0520 Mon Sep 17 00:00:00 2001 From: Alasdair Campbell Date: Sun, 7 Oct 2012 10:46:54 +0100 Subject: Platinum: use PersonRole for directors. Also fixes ::FromDidl for authors, actors, directors - previously duplicate entries were present --- .../Platinum/Source/Devices/MediaServer/PltDidl.h | 40 ++++++++++++---------- .../Source/Devices/MediaServer/PltMediaItem.cpp | 12 +++++++ .../Source/Devices/MediaServer/PltMediaItem.h | 2 +- xbmc/network/upnp/UPnPInternal.cpp | 12 +++++-- 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h index f6eaf1486f..c50d450913 100644 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltDidl.h @@ -61,28 +61,29 @@ #define PLT_FILTER_MASK_ORIGINALTRACK 0x00000100 #define PLT_FILTER_MASK_ACTOR 0x00000200 #define PLT_FILTER_MASK_AUTHOR 0x00000400 -#define PLT_FILTER_MASK_DATE 0x00000800 -#define PLT_FILTER_MASK_PROGRAMTITLE 0x00001000 -#define PLT_FILTER_MASK_SERIESTITLE 0x00002000 -#define PLT_FILTER_MASK_EPISODE 0x00004000 -#define PLT_FILTER_MASK_TITLE 0x00008000 +#define PLT_FILTER_MASK_DIRECTOR 0x00000800 +#define PLT_FILTER_MASK_DATE 0x00001000 +#define PLT_FILTER_MASK_PROGRAMTITLE 0x00002000 +#define PLT_FILTER_MASK_SERIESTITLE 0x00004000 +#define PLT_FILTER_MASK_EPISODE 0x00008000 +#define PLT_FILTER_MASK_TITLE 0x00010000 -#define PLT_FILTER_MASK_RES 0x00010000 -#define PLT_FILTER_MASK_RES_DURATION 0x00020000 -#define PLT_FILTER_MASK_RES_SIZE 0x00040000 -#define PLT_FILTER_MASK_RES_PROTECTION 0x00080000 -#define PLT_FILTER_MASK_RES_RESOLUTION 0x00100000 -#define PLT_FILTER_MASK_RES_BITRATE 0x00200000 -#define PLT_FILTER_MASK_RES_BITSPERSAMPLE 0x00400000 -#define PLT_FILTER_MASK_RES_NRAUDIOCHANNELS 0x00800000 -#define PLT_FILTER_MASK_RES_SAMPLEFREQUENCY 0x01000000 +#define PLT_FILTER_MASK_RES 0x00020000 +#define PLT_FILTER_MASK_RES_DURATION 0x00040000 +#define PLT_FILTER_MASK_RES_SIZE 0x00080000 +#define PLT_FILTER_MASK_RES_PROTECTION 0x00100000 +#define PLT_FILTER_MASK_RES_RESOLUTION 0x00200000 +#define PLT_FILTER_MASK_RES_BITRATE 0x00400000 +#define PLT_FILTER_MASK_RES_BITSPERSAMPLE 0x00800000 +#define PLT_FILTER_MASK_RES_NRAUDIOCHANNELS 0x01000000 +#define PLT_FILTER_MASK_RES_SAMPLEFREQUENCY 0x02000000 -#define PLT_FILTER_MASK_LONGDESCRIPTION 0x02000000 -#define PLT_FILTER_MASK_ICON 0x04000000 +#define PLT_FILTER_MASK_LONGDESCRIPTION 0x04000000 +#define PLT_FILTER_MASK_ICON 0x08000000 -#define PLT_FILTER_MASK_TOC 0x02000000 -#define PLT_FILTER_MASK_SEARCHCLASS 0x04000000 -#define PLT_FILTER_MASK_REFID 0x08000000 +#define PLT_FILTER_MASK_TOC 0x10000000 +#define PLT_FILTER_MASK_SEARCHCLASS 0x20000000 +#define PLT_FILTER_MASK_REFID 0x40000000 #define PLT_FILTER_FIELD_TITLE "dc:title" #define PLT_FILTER_FIELD_CREATOR "dc:creator" @@ -90,6 +91,7 @@ #define PLT_FILTER_FIELD_ARTIST "upnp:artist" #define PLT_FILTER_FIELD_ACTOR "upnp:actor" #define PLT_FILTER_FIELD_AUTHOR "upnp:author" +#define PLT_FILTER_FIELD_DIRECTOR "upnp:director" #define PLT_FILTER_FIELD_ALBUM "upnp:album" #define PLT_FILTER_FIELD_GENRE "upnp:genre" #define PLT_FILTER_FIELD_ALBUMARTURI "upnp:albumArtURI" diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp index 214f13d00d..64437d21fd 100644 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.cpp @@ -253,6 +253,11 @@ PLT_MediaObject::ToDidl(NPT_UInt32 mask, NPT_String& didl) m_People.authors.ToDidl(didl, "author"); } + // director + if (mask & PLT_FILTER_MASK_DIRECTOR) { + m_People.directors.ToDidl(didl, "director"); + } + // album if ((mask & PLT_FILTER_MASK_ALBUM) && !m_Affiliation.album.IsEmpty()) { didl += ""; @@ -489,15 +494,22 @@ PLT_MediaObject::FromDidl(NPT_XmlElementNode* entry) m_Title = m_Title.SubString(0, 256); m_ObjectClass.type = m_ObjectClass.type.SubString(0, 256); + children.Clear(); PLT_XmlHelper::GetChildren(entry, children, "artist", didl_namespace_upnp); m_People.artists.FromDidl(children); + children.Clear(); PLT_XmlHelper::GetChildren(entry, children, "author", didl_namespace_upnp); m_People.authors.FromDidl(children); + children.Clear(); PLT_XmlHelper::GetChildren(entry, children, "actors", didl_namespace_upnp); m_People.actors.FromDidl(children); + children.Clear(); + PLT_XmlHelper::GetChildren(entry, children, "director", didl_namespace_upnp); + m_People.directors.FromDidl(children); + PLT_XmlHelper::GetChildText(entry, "album", m_Affiliation.album, didl_namespace_upnp, 256); PLT_XmlHelper::GetChildText(entry, "programTitle", m_Recorded.program_title, didl_namespace_upnp); PLT_XmlHelper::GetChildText(entry, "seriesTitle", m_Recorded.series_title, didl_namespace_upnp); diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h index 8261244b81..84704b150a 100644 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltMediaItem.h @@ -91,7 +91,7 @@ typedef struct { PLT_PersonRoles actors; PLT_PersonRoles authors; NPT_String producer; //TODO: can be multiple - NPT_String director; //TODO: can be multiple + PLT_PersonRoles directors; NPT_String publisher; //TODO: can be multiple NPT_String contributor; // should match m_Creator (dc:creator) //TODO: can be multiple } PLT_PeopleInfo; diff --git a/xbmc/network/upnp/UPnPInternal.cpp b/xbmc/network/upnp/UPnPInternal.cpp index d6d8674801..bc033394bd 100644 --- a/xbmc/network/upnp/UPnPInternal.cpp +++ b/xbmc/network/upnp/UPnPInternal.cpp @@ -272,7 +272,9 @@ PopulateObjectFromTag(CVideoInfoTag& tag, object.m_People.actors.Add(it->strName.c_str(), it->strRole.c_str()); } - object.m_People.director = StringUtils::Join(tag.m_director, g_advancedSettings.m_videoItemSeparator); + for (unsigned int index = 0; index < tag.m_director.size(); index++) + object.m_People.directors.Add(tag.m_director[index].c_str()); + for (unsigned int index = 0; index < tag.m_writingCredits.size(); index++) object.m_People.authors.Add(tag.m_writingCredits[index].c_str()); @@ -486,7 +488,8 @@ BuildObject(CFileItem& item, container->m_People.actors.Add(it->strName.c_str(), it->strRole.c_str()); } - container->m_People.director = StringUtils::Join(tag.m_director, g_advancedSettings.m_videoItemSeparator);; + for (unsigned int index = 0; index < tag.m_director.size(); index++) + container->m_People.directors.Add(tag.m_director[index].c_str()); for (unsigned int index = 0; index < tag.m_writingCredits.size(); index++) container->m_People.authors.Add(tag.m_writingCredits[index].c_str()); @@ -641,7 +644,10 @@ PopulateTagFromObject(CVideoInfoTag& tag, tag.m_iYear = date.GetYear(); for (unsigned int index = 0; index < object.m_Affiliation.genres.GetItemCount(); index++) tag.m_genre.push_back(object.m_Affiliation.genres.GetItem(index)->GetChars()); - tag.m_director = StringUtils::Split((CStdString)object.m_People.director, g_advancedSettings.m_videoItemSeparator); + for (unsigned int index = 0; index < object.m_People.directors.GetItemCount(); index++) + tag.m_director.push_back(object.m_People.directors.GetItem(index)->name.GetChars()); + for (unsigned int index = 0; index < object.m_People.authors.GetItemCount(); index++) + 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_strShowTitle = object.m_Recorded.series_title; -- cgit v1.2.3