diff options
author | chriszero <zerov83@gmail.com> | 2015-06-25 19:35:50 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-06-25 19:35:50 +0200 |
commit | bc21cd691cd45ce4419a8b9d6b0ee561103c8254 (patch) | |
tree | e3b352fa7bc3d5e74e39bf05e68a3306585efc18 | |
parent | 4a54de45b40483e578fa3e97784532e57fedbe52 (diff) | |
download | vdr-plugin-plex-bc21cd691cd45ce4419a8b9d6b0ee561103c8254.tar.gz vdr-plugin-plex-bc21cd691cd45ce4419a8b9d6b0ee561103c8254.tar.bz2 |
Fixed token {seriestitle|genres|roles}
-rw-r--r-- | Directory.cpp | 44 | ||||
-rw-r--r-- | Directory.h | 2 | ||||
-rw-r--r-- | PVideo.cpp | 6 |
3 files changed, 33 insertions, 19 deletions
diff --git a/Directory.cpp b/Directory.cpp index 1f4c8b3..0ff9fa4 100644 --- a/Directory.cpp +++ b/Directory.cpp @@ -31,6 +31,7 @@ Directory::Directory(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* m_sTitle = GetNodeValue(pAttribs->getNamedItem("title")); m_sTitle1 = GetNodeValue(pAttribs->getNamedItem("title1")); m_sTitle2 = GetNodeValue(pAttribs->getNamedItem("title2")); + m_sParentTitle = GetNodeValue(pAttribs->getNamedItem("parentTitle")); m_sComposite = GetNodeValue(pAttribs->getNamedItem("composite")); m_sLanguage = GetNodeValue(pAttribs->getNamedItem("language")); m_sUuid = GetNodeValue(pAttribs->getNamedItem("uuid")); @@ -38,6 +39,7 @@ Directory::Directory(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* m_tCreatedAt = GetNodeValueAsTimeStamp(pAttribs->getNamedItem("createdAt")); m_eType = GetNodeValueAsMediaType(pAttribs->getNamedItem("type")); m_sSummary = GetNodeValue(pAttribs->getNamedItem("summary")); + m_sParentSummary = GetNodeValue(pAttribs->getNamedItem("parentSummary")); m_sStudio = GetNodeValue(pAttribs->getNamedItem("studio")); pAttribs->release(); @@ -45,7 +47,7 @@ Directory::Directory(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* Poco::XML::AutoPtr<Poco::XML::NamedNodeMap> pAttribs = pChildNode->attributes(); m_vGenre.push_back(GetNodeValue(pAttribs->getNamedItem("tag"))); pAttribs->release(); - + } else if(Poco::icompare(pChildNode->nodeName(), "Role") == 0) { Poco::XML::AutoPtr<Poco::XML::NamedNodeMap> pAttribs = pChildNode->attributes(); m_vRole.push_back(GetNodeValue(pAttribs->getNamedItem("tag"))); @@ -92,6 +94,18 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo if(m_eType == MediaType::UNDEF || m_eType == MediaType::MOVIE || m_eType == MediaType::PHOTO) { grid->AddIntToken("isdirectory", true); } + + map<string, string> roles; + for(auto it = m_vRole.begin(); it != m_vRole.end(); it++) { + roles["actor"] = *it; + } + grid->AddLoopToken("roles", roles); + + map<string, string> genres; + for(auto it = m_vGenre.begin(); it != m_vGenre.end(); it++) { + genres["genre"] = *it; + } + grid->AddLoopToken("genres", genres); if(m_eType == MediaType::SHOW) { grid->AddIntToken("isshow", true); @@ -102,29 +116,27 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo grid->AddIntToken("rating", m_fRating*10); grid->AddStringToken("ratingstring", Poco::format("%.1f", m_fRating)); grid->AddStringToken("studio", m_sStudio); - - map<string, string> roles; - for(auto it = m_vRole.begin(); it != m_vRole.end(); it++) { - roles["actor"] = *it; - } - grid->AddLoopToken("roles", roles); - - map<string, string> gernes; - for(auto it = m_vGenre.begin(); it != m_vGenre.end(); it++) { - gernes["genre"] = *it; - } - grid->AddLoopToken("genres", gernes); - + grid->AddIntToken("year", m_iYear); } if(m_eType == MediaType::SEASON) { grid->AddIntToken("isseason", true); - if(m_pParent) grid->AddStringToken("summary", m_pParent->m_sSummary); + + std::string summary = m_sParentSummary; + if(m_sParentSummary.empty() && m_pParent) + summary = m_pParent->m_sSummary; + + grid->AddStringToken("summary", summary); grid->AddIntToken("season", m_iIndex); grid->AddIntToken("leafCount", m_iLeafCount); grid->AddIntToken("viewedLeafCount", m_iViewedLeafCount); - grid->AddStringToken("seriestitle", m_pParent->m_sParentTitle); + + std::string seriesTitle = m_sParentTitle; + if(seriesTitle.empty() && m_pParent) + seriesTitle = m_pParent->m_sParentTitle; + + grid->AddStringToken("seriestitle", seriesTitle); grid->AddIntToken("year", m_pParent->m_iParentYear); } diff --git a/Directory.h b/Directory.h index 1c4a7a0..a9b2ba7 100644 --- a/Directory.h +++ b/Directory.h @@ -45,9 +45,11 @@ public: int m_iChildCount; // Number of Seasons double m_fRating; std::string m_sSummary; + std::string m_sParentSummary; std::string m_sTitle; std::string m_sTitle1; std::string m_sTitle2; + std::string m_sParentTitle; std::string m_sComposite; std::string m_sLanguage; std::string m_sUuid; @@ -272,11 +272,11 @@ void Video::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool c } grid->AddLoopToken("roles", roles); - map<string, string> gernes; + map<string, string> genres; for(auto it = m_vGenre.begin(); it != m_vGenre.end(); it++) { - gernes["genre"] = *it; + genres["genre"] = *it; } - grid->AddLoopToken("genres", gernes); + grid->AddLoopToken("genres", genres); grid->AddIntToken("originallyAvailableYear", m_tOriginallyAvailableAt.year()); grid->AddIntToken("originallyAvailableMonth", m_tOriginallyAvailableAt.month()); |