From e412257abf8de4576a180351d24ff07589fa630c Mon Sep 17 00:00:00 2001 From: chriszero Date: Sat, 14 Feb 2015 18:53:11 +0100 Subject: Various Fixes Bump Version to frist beta. --- PVideo.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'PVideo.cpp') diff --git a/PVideo.cpp b/PVideo.cpp index b186da8..881ffe4 100644 --- a/PVideo.cpp +++ b/PVideo.cpp @@ -1,9 +1,10 @@ #include "PVideo.h" +#include namespace plexclient { -Video::Video(Poco::XML::Node* pNode, PlexServer Server) +Video::Video(Poco::XML::Node* pNode, PlexServer Server, MediaContainer* parent) { m_iMyPlayOffset = 0; m_Server = Server; @@ -16,6 +17,8 @@ Video::Video(Poco::XML::Node* pNode, PlexServer Server) Poco::XML::AutoPtr pAttribs = pNode->attributes(); m_iRatingKey = GetNodeValueAsInt(pAttribs->getNamedItem("ratingKey")); + m_iIndex = GetNodeValueAsInt(pAttribs->getNamedItem("index")); + m_iParentIndex = GetNodeValueAsInt(pAttribs->getNamedItem("parentIndex")); m_sKey = GetNodeValue(pAttribs->getNamedItem("key")); m_sStudio = GetNodeValue(pAttribs->getNamedItem("studio")); m_tType = GetNodeValueAsMediaType(pAttribs->getNamedItem("type")); @@ -51,6 +54,25 @@ Video::Video(Poco::XML::Node* pNode, PlexServer Server) } pChildNode = it.nextNode(); } + if (m_iParentIndex < 0) { + m_iParentIndex = parent->m_iParentIndex; + } } +std::string Video::GetTitle() +{ + std::string res = m_sTitle; + switch(m_tType) { + case MOVIE: + res = Poco::format("%s (%d)", m_sTitle, m_iYear); + break; + case EPISODE: + res = Poco::format("%02dx%02d - %s", m_iParentIndex, m_iIndex, m_sTitle); + break; + default: + break; + } + return res; } + +} // Namespace -- cgit v1.2.3