diff options
author | chriszero <zerov83@gmail.com> | 2015-04-09 20:41:33 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-04-09 20:41:33 +0200 |
commit | 4bf454247a21b684f2bb0ac763adeea18a86d153 (patch) | |
tree | 87966d27bb0cbf1bea486076e0b2dc2d4a7a4d60 | |
parent | 376c9f258eba669892c2ab00a0863a195ff9d5e8 (diff) | |
download | vdr-plugin-plex-4bf454247a21b684f2bb0ac763adeea18a86d153.tar.gz vdr-plugin-plex-4bf454247a21b684f2bb0ac763adeea18a86d153.tar.bz2 |
more tokens
-rw-r--r-- | Directory.cpp | 37 | ||||
-rw-r--r-- | Directory.h | 7 | ||||
-rw-r--r-- | MediaContainer.cpp | 14 | ||||
-rw-r--r-- | MediaContainer.h | 5 | ||||
-rw-r--r-- | skins/blackhole/xmlfiles/plug-plex-root.xml | 48 |
5 files changed, 83 insertions, 28 deletions
diff --git a/Directory.cpp b/Directory.cpp index a598a8f..eeb8c1d 100644 --- a/Directory.cpp +++ b/Directory.cpp @@ -15,6 +15,10 @@ Directory::Directory(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* m_bAllowSync = GetNodeValueAsBool(pAttribs->getNamedItem("allowSync")); m_iIndex = GetNodeValueAsInt(pAttribs->getNamedItem("index")); + m_iLeafCount = GetNodeValueAsInt(pAttribs->getNamedItem("leafCount")); + m_iViewedLeafCount = GetNodeValueAsInt(pAttribs->getNamedItem("viewedLeafCount")); + m_iChildCount = GetNodeValueAsInt(pAttribs->getNamedItem("childCount")); + m_fRating = GetNodeValueAsDouble(pAttribs->getNamedItem("rating")); m_iYear = GetNodeValueAsInt(pAttribs->getNamedItem("year")); m_sArt = GetNodeValue(pAttribs->getNamedItem("art")); m_sThumb = GetNodeValue(pAttribs->getNamedItem("thumb")); @@ -28,6 +32,7 @@ Directory::Directory(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* m_tUpdatedAt = GetNodeValueAsTimeStamp(pAttribs->getNamedItem("updatedAt")); m_tCreatedAt = GetNodeValueAsTimeStamp(pAttribs->getNamedItem("createdAt")); m_eType = GetNodeValueAsMediaType(pAttribs->getNamedItem("type")); + m_sSummary = GetNodeValue(pAttribs->getNamedItem("summary")); pAttribs->release(); } @@ -51,24 +56,30 @@ void Directory::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::fu // Thumb, Cover, Episodepicture bool cached = false; - std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this); + if(!ThumbUri().empty()) { + std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this); + if (cached) grid->AddStringToken("thumb", thumb); + } grid->AddIntToken("hasthumb", cached); - if (cached) grid->AddStringToken("thumb", thumb); // Fanart cached = false; - std::string art = cPictureCache::GetInstance().GetPath(ArtUri(), Config::GetInstance().ArtWidth(), Config::GetInstance().ArtHeight(), cached); + if(!ArtUri().empty()) { + std::string art = cPictureCache::GetInstance().GetPath(ArtUri(), Config::GetInstance().ArtWidth(), Config::GetInstance().ArtHeight(), cached); + if (cached) grid->AddStringToken("art", art); + } grid->AddIntToken("hasart", cached); - if (cached) grid->AddStringToken("art", art); if(m_eType == MediaType::SHOW) { grid->AddIntToken("isshow", true); + grid->AddStringToken("summary", m_sSummary); } if(m_eType == MediaType::SEASON) { grid->AddIntToken("isseason", true); + if(m_pParent) grid->AddStringToken("summary", m_pParent->m_sSummary); } - + // Banner, Seriesbanner if(m_pParent && !m_pParent->m_sBanner.empty()) { cached = false; @@ -82,14 +93,22 @@ void Directory::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::fu std::string Directory::ArtUri() { - if(m_sArt.find("http://") != std::string::npos) return m_sArt; - return m_pServer->GetUri() + m_sArt; + if(!m_sArt.empty()) { + if(m_sArt.find("http://") != std::string::npos) return m_sArt; + return m_pServer->GetUri() + m_sArt; + } + if(m_pParent) return m_pParent->ArtUri(); + return ""; } std::string Directory::ThumbUri() { - if(m_sThumb.find("http://") != std::string::npos) return m_sThumb; - return m_pServer->GetUri() + m_sThumb; + if(!m_sThumb.empty()) { + if(m_sThumb.find("http://") != std::string::npos) return m_sThumb; + return m_pServer->GetUri() + m_sThumb; + } + if(m_pParent) return m_pParent->ThumbUri(); + return ""; } } diff --git a/Directory.h b/Directory.h index e97b241..8ccea87 100644 --- a/Directory.h +++ b/Directory.h @@ -38,8 +38,13 @@ public: public: bool m_bAllowSync; - int m_iIndex; + int m_iIndex; // Season, Episode number int m_iYear; + int m_iLeafCount; // Total number of Episodes + int m_iViewedLeafCount; // Watched Episodes + int m_iChildCount; // Number of Seasons + double m_fRating; + std::string m_sSummary; std::string m_sTitle; std::string m_sTitle1; std::string m_sTitle2; diff --git a/MediaContainer.cpp b/MediaContainer.cpp index 959c537..8f68300 100644 --- a/MediaContainer.cpp +++ b/MediaContainer.cpp @@ -33,6 +33,8 @@ MediaContainer::MediaContainer(std::istream* response, PlexServer* Server) m_bAllowSync = GetNodeValueAsBool(pAttribs->getNamedItem("allowSync")); m_sArt = GetNodeValue(pAttribs->getNamedItem("art")); m_sSummary = GetNodeValue(pAttribs->getNamedItem("summary")); + m_iParentIndex = GetNodeValueAsInt(pAttribs->getNamedItem("parentIndex")); + m_iParentYear = GetNodeValueAsInt(pAttribs->getNamedItem("parentYear")); pAttribs->release(); } else if(Poco::icompare(pNode->nodeName(), "Directory") == 0) { @@ -49,6 +51,18 @@ MediaContainer::MediaContainer(std::istream* response, PlexServer* Server) } } +std::string MediaContainer::ArtUri() +{ + if(m_sArt.find("http://") != std::string::npos) return m_sArt; + return m_pServer->GetUri() + m_sArt; +} + +std::string MediaContainer::ThumbUri() +{ + if(m_sThumb.find("http://") != std::string::npos) return m_sThumb; + return m_pServer->GetUri() + m_sThumb; +} + void MediaContainer::PreCache() { bool foo; diff --git a/MediaContainer.h b/MediaContainer.h index 0a538ed..14fb29e 100644 --- a/MediaContainer.h +++ b/MediaContainer.h @@ -62,8 +62,13 @@ public: int m_iSize; std::string m_sSummary; int m_iParentIndex; + std::string m_sParentTitle; + int m_iParentYear; + PlexServer* m_pServer; + std::string ThumbUri(); + std::string ArtUri(); void PreCache(); }; diff --git a/skins/blackhole/xmlfiles/plug-plex-root.xml b/skins/blackhole/xmlfiles/plug-plex-root.xml index 67c5a2c..b1c0d83 100644 --- a/skins/blackhole/xmlfiles/plug-plex-root.xml +++ b/skins/blackhole/xmlfiles/plug-plex-root.xml @@ -60,28 +60,40 @@ </viewelement> <!-- Tokens available in browser - {current} Currently active element - {title} Name of the element - {year} - {hasthumb} - {thumb} Image/Cover - {hasart} - {art} Fanart + {current} bool, currently active element + {title} string, Name of the element - {isdummy} Condition + A dummy actually only marks a "level up" + {isdummy} bool - {isserver} Condition - {serverstartpointname} - {serverip} - {serverport} - {serverversion} - - {isdirectory} Condition - {isshow} Condition - {isseason} Condition + If the item is a server: {isserver} + {isserver} bool + {serverstartpointname} string + {serverip} string + {serverport} int + {serverversion} string + + Following tokens are avaliable if the item is a directory or video + {hasthumb} bool + {thumb} string, Image/Cover + {hasart} bool + {art} string, Fanart + + If the Item is Directory following tokens are avaliable + The item is a directory if one of the following tokens are set: {isdirectory}, {isshow}, {isseason} + + {isdirectory} Condition + {isshow} Condition + {isseason} Condition + + If the item is a video following tokens are avaliable + The item is a video if one of the following tokens are set: {ismovie}, {isepisode} + {contentrating} string, star-rating + {viewoffset} int, seconds, last viewed position + {duration} int, seconds, total duration + {ismovie} - {isepisode} {hasbanner} {banner} |