summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian <zerov83@gmail.com>2016-02-21 20:39:12 +0100
committerChristian <zerov83@gmail.com>2016-02-21 20:39:12 +0100
commit6b8c8aec4fe01136b3092981e4a9c5d486d098df (patch)
tree5df4b2dc84af1e5d58d50dc394fb747ac52888ac
parent96a27aa661e2e5562dd9fac1b8eadf0304f92da1 (diff)
downloadvdr-plugin-plex-6b8c8aec4fe01136b3092981e4a9c5d486d098df.tar.gz
vdr-plugin-plex-6b8c8aec4fe01136b3092981e4a9c5d486d098df.tar.bz2
libskindesignerapi 0.1.0 support
-rw-r--r--Directory.cpp73
-rw-r--r--Makefile4
-rw-r--r--Media.cpp21
-rw-r--r--PVideo.cpp82
-rw-r--r--browserGrid.cpp169
-rw-r--r--plex.cpp83
-rw-r--r--plex.h3
-rw-r--r--plexSdOsd.cpp155
-rw-r--r--plexSdOsd.h32
-rw-r--r--po/de_DE.po2
-rw-r--r--templates/plug-plex-root.xml6
-rw-r--r--tokendefinitions.h171
-rw-r--r--viewGridNavigator.cpp13
-rw-r--r--viewHeader.cpp22
14 files changed, 557 insertions, 279 deletions
diff --git a/Directory.cpp b/Directory.cpp
index 6d3d370..e2b1072 100644
--- a/Directory.cpp
+++ b/Directory.cpp
@@ -1,6 +1,7 @@
#include "Directory.h"
#include <vdr/i18n.h>
#include <Poco/Format.h>
+#include "tokendefinitions.h"
namespace plexclient
{
@@ -75,73 +76,75 @@ std::string Directory::GetTitle()
void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool clear, std::function<void(cGridElement*)> OnCached)
{
if(clear) grid->ClearTokens();
- grid->AddIntToken("viewmode", Config::GetInstance().DefaultViewMode);
- grid->AddStringToken("title", m_sTitle);
- grid->AddIntToken("viewgroup", m_pParent->m_eViewGroup);
+ grid->AddIntToken((int)(eTokenGridInt::viewmode), Config::GetInstance().DefaultViewMode);
+ grid->AddStringToken((int)(eTokenGridStr::title), m_sTitle.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::viewgroup), m_pParent->m_eViewGroup);
// Thumb, Cover, Episodepicture
bool cached = false;
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);
+ if (cached) grid->AddStringToken((int)(eTokenGridStr::thumb), thumb.c_str());
}
- grid->AddIntToken("hasthumb", cached);
+ grid->AddIntToken((int)(eTokenGridInt::hasthumb), cached);
// Fanart
cached = false;
if(!ArtUri().empty()) {
std::string art = cPictureCache::GetInstance().GetPath(ArtUri(), Config::GetInstance().ArtWidth(), Config::GetInstance().ArtHeight(), cached);
- if (cached) grid->AddStringToken("art", art);
+ if (cached) grid->AddStringToken((int)(eTokenGridStr::art), art.c_str());
}
- grid->AddIntToken("hasart", cached);
+ grid->AddIntToken((int)(eTokenGridInt::hasart), cached);
if(m_eType == MediaType::UNDEF || m_eType == MediaType::MOVIE || m_eType == MediaType::PHOTO) {
- grid->AddIntToken("isdirectory", true);
+ grid->AddIntToken((int)(eTokenGridInt::isdirectory), true);
}
-
+ /*
+ int actloopIndex = grid->GetLoopIndex("roles");
+ int i = 0;
for(auto it = m_vRole.begin(); it != m_vRole.end(); it++) {
- map<string, string> roles;
- roles["actor"] = *it;
- grid->AddLoopToken("actor[roles]", roles);
+ grid->AddLoopToken(actloopIndex, i, (int)(eTokenGridActorLst::roles), it->c_str());
+ i++;
}
+ int genloopIndex = grid->GetLoopIndex("genres");
+ i = 0;
for(auto it = m_vGenre.begin(); it != m_vGenre.end(); it++) {
- map<string, string> genres;
- genres.insert(std::pair<string, string>("genres[genre]", *it));
- grid->AddLoopToken("genres", genres);
+ grid->AddLoopToken(genloopIndex, i, (int)(eTokenGridGenresLst::genres), it->c_str());
+ i++;
}
-
+*/
if(m_eType == MediaType::SHOW) {
- grid->AddIntToken("isshow", true);
- grid->AddStringToken("summary", m_sSummary);
- grid->AddIntToken("leafCount", m_iLeafCount);
- grid->AddIntToken("viewedLeafCount", m_iViewedLeafCount);
- grid->AddIntToken("childCount", m_iChildCount);
- grid->AddIntToken("rating", m_fRating*10);
- grid->AddStringToken("ratingstring", Poco::format("%.1f", m_fRating));
- grid->AddStringToken("studio", m_sStudio);
-
- grid->AddIntToken("year", m_iYear);
+ grid->AddIntToken((int)(eTokenGridInt::isshow), true);
+ grid->AddStringToken((int)(eTokenGridStr::summary), m_sSummary.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::leafCount), m_iLeafCount);
+ grid->AddIntToken((int)(eTokenGridInt::viewedLeafCount), m_iViewedLeafCount);
+ grid->AddIntToken((int)(eTokenGridInt::childCount), m_iChildCount);
+ grid->AddIntToken((int)(eTokenGridInt::rating), m_fRating*10);
+ grid->AddStringToken((int)(eTokenGridStr::ratingstring), Poco::format("%.1f", m_fRating).c_str());
+ grid->AddStringToken((int)(eTokenGridStr::studio), m_sStudio.c_str());
+
+ grid->AddIntToken((int)(eTokenGridInt::year), m_iYear);
}
if(m_eType == MediaType::SEASON) {
- grid->AddIntToken("isseason", true);
+ grid->AddIntToken((int)(eTokenGridInt::isseason), true);
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((int)(eTokenGridStr::summary), summary.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::season), m_iIndex);
+ grid->AddIntToken((int)(eTokenGridInt::leafCount), m_iLeafCount);
+ grid->AddIntToken((int)(eTokenGridInt::viewedLeafCount), m_iViewedLeafCount);
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);
+ grid->AddStringToken((int)(eTokenGridStr::seriestitle), seriesTitle.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::year), m_pParent->m_iParentYear);
}
// Banner, Seriesbanner
@@ -149,8 +152,8 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo
cached = false;
std::string banner = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_pParent->m_sBanner, Config::GetInstance().BannerWidth(), Config::GetInstance().BannerHeight(), cached, OnCached, this);
if(cached) {
- grid->AddIntToken("hasbanner", cached);
- grid->AddStringToken("banner", banner);
+ grid->AddIntToken((int)(eTokenGridInt::hasbanner), cached);
+ grid->AddStringToken((int)(eTokenGridStr::banner), banner.c_str());
}
}
}
diff --git a/Makefile b/Makefile
index 31fa4ca..53cc053 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ LIBS += $(shell pkg-config --libs libskindesignerapi)
### Configuration (edit this for your needs)
-CONFIG := #-DDEBUG # uncomment to build DEBUG
+#CONFIG := -DDEBUG # uncomment to build DEBUG
DISABLESKINDESIGNER ?= 0
### The version number of this plugin (taken from the main source file):
@@ -40,7 +40,7 @@ export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
#CXXFLAGS += -std=gnu++0x
-CXXFLAGS += -std=c++11
+export CXXFLAGS += -std=c++11
### The version number of VDR's plugin API:
diff --git a/Media.cpp b/Media.cpp
index faf7af6..35eef23 100644
--- a/Media.cpp
+++ b/Media.cpp
@@ -1,4 +1,5 @@
#include "Media.h"
+#include "tokendefinitions.h"
namespace plexclient
{
@@ -50,16 +51,16 @@ Media::Media(Poco::XML::Node* pNode)
#ifdef SKINDESIGNER
void Media::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid)
{
- grid->AddStringToken("videoResolution", m_sVideoResolution);
- grid->AddIntToken("bitrate", m_iBitrate);
- grid->AddIntToken("width", m_iWidth);
- grid->AddIntToken("height", m_iHeight);
- grid->AddIntToken("audioChannels", m_iAudioChannels);
- grid->AddStringToken("aspectRatio", m_sAspectRatio);
- grid->AddStringToken("audioCodec", m_sAudioCodec);
- grid->AddStringToken("videoCodec", m_sVideoCodec);
- grid->AddStringToken("container", m_sContainer);
- grid->AddStringToken("videoFrameRate", m_VideoFrameRate);
+ grid->AddStringToken((int)(eTokenGridStr::videoResolution), m_sVideoResolution.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::bitrate), m_iBitrate);
+ grid->AddIntToken((int)(eTokenGridInt::width), m_iWidth);
+ grid->AddIntToken((int)(eTokenGridInt::height), m_iHeight);
+ grid->AddIntToken((int)(eTokenGridInt::audioChannels), m_iAudioChannels);
+ grid->AddStringToken((int)(eTokenGridStr::aspectRatio), m_sAspectRatio.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::audioCodec), m_sAudioCodec.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::videoCodec), m_sVideoCodec.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::container), m_sContainer.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::videoFrameRate), m_VideoFrameRate.c_str());
}
#endif
diff --git a/PVideo.cpp b/PVideo.cpp
index b7ad379..57254ba 100644
--- a/PVideo.cpp
+++ b/PVideo.cpp
@@ -6,6 +6,7 @@
#include <vdr/tools.h>
#include "PlexHelper.h"
+#include "tokendefinitions.h"
namespace plexclient
{
@@ -231,64 +232,65 @@ bool Video::SetWatched()
void Video::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool clear, std::function<void(cGridElement*)> OnCached)
{
if(clear) grid->ClearTokens();
- grid->AddIntToken("viewmode", Config::GetInstance().DefaultViewMode);
- grid->AddStringToken("title", m_sTitle);
- grid->AddStringToken("orginaltitle", m_sOriginalTitle);
- grid->AddStringToken("summary", m_sSummary);
- grid->AddStringToken("contentrating", m_sContentRating);
- grid->AddIntToken("rating", m_dRating*10);
- grid->AddStringToken("ratingstring", Poco::format("%.1f", m_dRating));
- grid->AddStringToken("studio", m_sStudio);
- grid->AddIntToken("viewCount", m_iViewCount);
- grid->AddIntToken("viewoffset", m_lViewoffset/1000/60);
+ grid->AddIntToken((int)(eTokenGridInt::viewmode), Config::GetInstance().DefaultViewMode);
+ grid->AddStringToken((int)(eTokenGridStr::title), m_sTitle.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::orginaltitle), m_sOriginalTitle.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::summary), m_sSummary.c_str());
+ grid->AddStringToken((int)(eTokenGridStr::contentrating), m_sContentRating.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::rating), m_dRating*10);
+ grid->AddStringToken((int)(eTokenGridStr::ratingstring), Poco::format("%.1f", m_dRating).c_str());
+ grid->AddStringToken((int)(eTokenGridStr::studio), m_sStudio.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::viewCount), m_iViewCount);
+ grid->AddIntToken((int)(eTokenGridInt::viewoffset), m_lViewoffset/1000/60);
if(m_iDuration > 0) // avoid division by zero
- grid->AddIntToken("viewoffsetpercent", 100.0 / m_iDuration * m_lViewoffset);
+ grid->AddIntToken((int)(eTokenGridInt::viewoffsetpercent), 100.0 / m_iDuration * m_lViewoffset);
else
- grid->AddIntToken("viewoffsetpercent", 0);
- grid->AddIntToken("duration", m_iDuration/1000/60);
- grid->AddIntToken("year", m_iYear);
- grid->AddIntToken("viewgroup", m_pParent->m_eViewGroup);
+ grid->AddIntToken((int)(eTokenGridInt::viewoffsetpercent), 0);
+ grid->AddIntToken((int)(eTokenGridInt::duration), m_iDuration/1000/60);
+ grid->AddIntToken((int)(eTokenGridInt::year), m_iYear);
+ grid->AddIntToken((int)(eTokenGridInt::viewgroup), m_pParent->m_eViewGroup);
// Thumb, Cover, Episodepicture
bool cached = false;
std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this);
- grid->AddIntToken("hasthumb", cached);
- if (cached) grid->AddStringToken("thumb", thumb);
+ grid->AddIntToken((int)(eTokenGridInt::hasthumb), cached);
+ if (cached) grid->AddStringToken((int)(eTokenGridStr::thumb), thumb.c_str());
// Fanart
cached = false;
std::string art = cPictureCache::GetInstance().GetPath(ArtUri(), Config::GetInstance().ArtWidth(), Config::GetInstance().ArtHeight(), cached);
- grid->AddIntToken("hasart", cached);
- if (cached) grid->AddStringToken("art", art);
+ grid->AddIntToken((int)(eTokenGridInt::hasart), cached);
+ if (cached) grid->AddStringToken((int)(eTokenGridStr::art), art.c_str());
if(m_tType == MediaType::MOVIE || m_tType == MediaType::CLIP) {
- grid->AddIntToken("ismovie", true);
+ grid->AddIntToken((int)(eTokenGridInt::ismovie), true);
}
-
+/*
+ int actloopIndex = grid->GetLoopIndex("roles");
+ int i = 0;
for(auto it = m_vRole.begin(); it != m_vRole.end(); it++) {
- map<string, string> roles;
- roles["actor"] = *it;
- grid->AddLoopToken("actor[roles]", roles);
+ grid->AddLoopToken(actloopIndex, i, (int)(eTokenGridActorLst::roles), it->c_str());
+ i++;
}
+ int genloopIndex = grid->GetLoopIndex("genres");
+ i = 0;
for(auto it = m_vGenre.begin(); it != m_vGenre.end(); it++) {
- map<string, string> genres;
- genres.insert(std::pair<string, string>("genres[genre]", *it));
- grid->AddLoopToken("genres", genres);
+ grid->AddLoopToken(genloopIndex, i, (int)(eTokenGridGenresLst::genres), it->c_str());
+ i++;
}
-
-
- grid->AddIntToken("originallyAvailableYear", m_tOriginallyAvailableAt.year());
- grid->AddIntToken("originallyAvailableMonth", m_tOriginallyAvailableAt.month());
- grid->AddIntToken("originallyAvailableDay", m_tOriginallyAvailableAt.day());
+ */
+ grid->AddIntToken((int)(eTokenGridInt::originallyAvailableYear), m_tOriginallyAvailableAt.year());
+ grid->AddIntToken((int)(eTokenGridInt::originallyAvailableMonth), m_tOriginallyAvailableAt.month());
+ grid->AddIntToken((int)(eTokenGridInt::originallyAvailableDay), m_tOriginallyAvailableAt.day());
if(m_tType == MediaType::EPISODE) {
- grid->AddIntToken("isepisode", true);
+ grid->AddIntToken((int)(eTokenGridInt::isepisode), true);
std::string seriesTitle = m_sGrandparentTitle;
if(seriesTitle.empty() && m_pParent) seriesTitle = m_pParent->m_sGrandparentTitle;
- grid->AddStringToken("seriestitle", seriesTitle);
- grid->AddIntToken("season", m_iParentIndex);
- grid->AddIntToken("episode", m_iIndex);
+ grid->AddStringToken((int)(eTokenGridStr::seriestitle), seriesTitle.c_str());
+ grid->AddIntToken((int)(eTokenGridInt::season), m_iParentIndex);
+ grid->AddIntToken((int)(eTokenGridInt::episode), m_iIndex);
// Seriescover, Seasoncover
cached = false;
@@ -298,17 +300,17 @@ void Video::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool c
}
if(!grandparentthumbUri.empty()) {
std::string grandparentThumb = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + grandparentthumbUri, Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this);
- if (cached) grid->AddStringToken("seriesthumb", grandparentThumb);
+ if (cached) grid->AddStringToken((int)(eTokenGridStr::seriesthumb), grandparentThumb.c_str());
}
- grid->AddIntToken("hasseriesthumb", cached);
+ grid->AddIntToken((int)(eTokenGridInt::hasseriesthumb), cached);
// Banner, Seriesbanner
if(m_pParent && !m_pParent->m_sBanner.empty()) {
cached = false;
std::string banner = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_pParent->m_sBanner, Config::GetInstance().BannerWidth(), Config::GetInstance().BannerHeight(), cached, OnCached, this);
if(cached) {
- grid->AddIntToken("hasbanner", cached);
- grid->AddStringToken("banner", banner);
+ grid->AddIntToken((int)(eTokenGridInt::hasbanner), cached);
+ grid->AddStringToken((int)(eTokenGridStr::banner), banner.c_str());
}
}
}
diff --git a/browserGrid.cpp b/browserGrid.cpp
index 5242a13..4163c08 100644
--- a/browserGrid.cpp
+++ b/browserGrid.cpp
@@ -5,15 +5,16 @@
#include "Directory.h"
#include "plex.h"
#include "pictureCache.h"
+#include "tokendefinitions.h"
cBrowserGrid::cBrowserGrid(std::shared_ptr<skindesignerapi::cOsdView> rootView) : cViewGridNavigator(rootView)
{
- m_pBackground = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verBackground));
- m_pHeader = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verHeader));
- m_pfooter = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verFooter));
- m_pInfopane = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verInfopane));
- m_pWatch = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verWatch));
- m_pScrollbar = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verScrollbar));
+ m_pBackground = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement((int)eViewElementsRoot::background));
+ m_pHeader = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement((int)eViewElementsRoot::header));
+ m_pfooter = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement((int)eViewElementsRoot::footer));
+ m_pInfopane = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement((int)eViewElementsRoot::infopane));
+ m_pWatch = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement((int)eViewElementsRoot::watch));
+ m_pScrollbar = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement((int)eViewElementsRoot::scrollbar));
m_lastsecond = 0;
m_pService = NULL;
@@ -23,13 +24,13 @@ cBrowserGrid::cBrowserGrid(std::shared_ptr<skindesignerapi::cOsdView> rootView)
Config *conf = &Config::GetInstance();
if(conf->DefaultViewMode == ViewMode::Cover) {
- SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(rootView->GetViewGrid(eViewGrids::vgCover) ));
+ SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(rootView->GetViewGrid((int)eViewGrids::cover) ));
SetGridDimensions(conf->CoverGridRows, conf->CoverGridColumns);
} else if(conf->DefaultViewMode == ViewMode::Detail) {
- SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(rootView->GetViewGrid(eViewGrids::vgDetail) ));
+ SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(rootView->GetViewGrid((int)eViewGrids::detail) ));
SetGridDimensions(conf->DetailGridRows, conf->DetailGridColumns);
} else if(conf->DefaultViewMode == ViewMode::List) {
- SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(rootView->GetViewGrid(eViewGrids::vgList) ));
+ SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(rootView->GetViewGrid((int)eViewGrids::list) ));
SetGridDimensions(conf->ListGridRows, conf->ListGridColumns);
}
@@ -74,13 +75,13 @@ void cBrowserGrid::SwitchView(ViewMode mode)
Config *conf = &Config::GetInstance();
conf->DefaultViewMode = mode;
if(conf->DefaultViewMode == ViewMode::Cover) {
- SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(m_pRootView->GetViewGrid(eViewGrids::vgCover) ));
+ SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(m_pRootView->GetViewGrid((int)eViewGrids::cover) ));
SetGridDimensions(conf->CoverGridRows, conf->CoverGridColumns);
} else if(conf->DefaultViewMode == ViewMode::Detail) {
- SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(m_pRootView->GetViewGrid(eViewGrids::vgDetail) ));
+ SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(m_pRootView->GetViewGrid((int)eViewGrids::detail) ));
SetGridDimensions(conf->DetailGridRows, conf->DetailGridColumns);
} else if(conf->DefaultViewMode == ViewMode::List) {
- SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(m_pRootView->GetViewGrid(eViewGrids::vgList) ));
+ SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>(m_pRootView->GetViewGrid((int)eViewGrids::list) ));
SetGridDimensions(conf->ListGridRows, conf->ListGridColumns);
}
@@ -119,29 +120,29 @@ void cBrowserGrid::SwitchGrid(int index)
m_pHeader->Clear();
m_pHeader->ClearTokens();
- m_pHeader->AddIntToken("columns", m_columns);
- m_pHeader->AddIntToken("rows", m_rows);
- m_pHeader->AddIntToken("totalcount", m_vElements.size());
+ m_pHeader->AddIntToken((int)eTokenGridInt::columns, m_columns);
+ m_pHeader->AddIntToken((int)eTokenGridInt::rows, m_rows);
+ m_pHeader->AddIntToken((int)eTokenGridInt::totalcount, m_vElements.size());
if(plexclient::plexgdm::GetInstance().GetFirstServer()) {
if(m_viewEntryIndex < (int)Config::GetInstance().m_viewentries.size()) {
ViewEntry entry = Config::GetInstance().m_viewentries[index];
- m_pHeader->AddStringToken("tabname", tr(entry.Name.c_str()));
+ m_pHeader->AddStringToken((int)eTokenGridStr::tabname, tr(entry.Name.c_str()));
m_pService = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetFirstServer(), entry.PlexPath ) );
m_pContainer = m_pService->GetSection(m_pService->StartUri);
m_bServersAreRoot = false;
m_vServerElements.clear();
} else {
//Server View
- m_pHeader->AddStringToken("tabname", tr("Library"));
+ m_pHeader->AddStringToken((int)eTokenGridStr::tabname, tr("Library"));
m_pService = NULL;
m_pContainer = NULL;
m_bServersAreRoot = true;
SetServerElements();
}
} else {
- m_pHeader->AddStringToken("tabname", tr("No Plex Media Server found."));
- m_pInfopane->AddStringToken("title", tr("No Plex Media Server found."));
+ m_pHeader->AddStringToken((int)eTokenGridStr::tabname, tr("No Plex Media Server found."));
+ m_pInfopane->AddStringToken((int)eTokenGridStr::title, tr("No Plex Media Server found."));
m_pService = NULL;
m_pContainer = NULL;
}
@@ -149,7 +150,7 @@ void cBrowserGrid::SwitchGrid(int index)
auto selObj = SelectedObject();
if(selObj) {
selObj->AddTokens(m_pHeader, false);
- m_pHeader->AddIntToken("position", selObj->AbsolutePosition);
+ m_pHeader->AddIntToken((int)eTokenGridInt::position, selObj->AbsolutePosition);
}
DrawBackground();
@@ -272,9 +273,9 @@ void cBrowserGrid::DrawBackground()
m_pBackground->AddStringToken("selecteditembackground", path);
}
*/
- m_pBackground->AddIntToken("isdirectory", 1);
- m_pBackground->AddStringToken("currentdirectorybackground", "/path");
- m_pBackground->AddIntToken("viewmode", Config::GetInstance().DefaultViewMode);
+ m_pBackground->AddIntToken((int)eTokenBackgroundInt::isdirectory, 1);
+ m_pBackground->AddStringToken((int)eTokenBackgroundStr::currentdirectorybackground, "/path");
+ m_pBackground->AddIntToken((int)eTokenBackgroundInt::viewmode, Config::GetInstance().DefaultViewMode);
}
void cBrowserGrid::DrawInfopane()
@@ -282,10 +283,10 @@ void cBrowserGrid::DrawInfopane()
m_pInfopane->Clear();
if(SelectedObject()) {
SelectedObject()->AddTokens(m_pInfopane, true);
- m_pInfopane->AddIntToken("columns", m_columns);
- m_pInfopane->AddIntToken("rows", m_rows);
- m_pInfopane->AddIntToken("totalcount", m_vElements.size());
- m_pInfopane->AddIntToken("position", SelectedObject()->AbsolutePosition);
+ m_pInfopane->AddIntToken((int)eTokenGridInt::columns, m_columns);
+ m_pInfopane->AddIntToken((int)eTokenGridInt::rows, m_rows);
+ m_pInfopane->AddIntToken((int)eTokenGridInt::totalcount, m_vElements.size());
+ m_pInfopane->AddIntToken((int)eTokenGridInt::position, SelectedObject()->AbsolutePosition);
}
m_pInfopane->Display();
}
@@ -321,41 +322,37 @@ void cBrowserGrid::DrawFooter()
m_pfooter->Clear();
m_pfooter->ClearTokens();
- m_pfooter->AddStringToken("red", textRed);
- m_pfooter->AddStringToken("green", textGreen);
- m_pfooter->AddStringToken("yellow", textYellow);
- m_pfooter->AddStringToken("blue", textBlue);
-
- for (int button = 1; button < 5; button++) {
- string red = *cString::sprintf("red%d", button);
- string green = *cString::sprintf("green%d", button);
- string yellow = *cString::sprintf("yellow%d", button);
- string blue = *cString::sprintf("blue%d", button);
- bool isRed = false;
- bool isGreen = false;
- bool isYellow = false;
- bool isBlue = false;
- switch (colorKeys[button-1]) {
- case 0:
- isRed = true;
- break;
- case 1:
- isGreen = true;
- break;
- case 2:
- isYellow = true;
- break;
- case 3:
- isBlue = true;
- break;
- default:
- break;
- }
- m_pfooter->AddIntToken(red, isRed);
- m_pfooter->AddIntToken(green, isGreen);
- m_pfooter->AddIntToken(yellow, isYellow);
- m_pfooter->AddIntToken(blue, isBlue);
- }
+ m_pfooter->AddStringToken((int)eTokenFooterStr::red, textRed.c_str());
+ m_pfooter->AddStringToken((int)eTokenFooterStr::green, textGreen.c_str());
+ m_pfooter->AddStringToken((int)eTokenFooterStr::yellow, textYellow.c_str());
+ m_pfooter->AddStringToken((int)eTokenFooterStr::blue, textBlue.c_str());
+
+ for (int button = 0; button < 4; button++) {
+ bool isRed = false;
+ bool isGreen = false;
+ bool isYellow = false;
+ bool isBlue = false;
+ switch (colorKeys[button]) {
+ case 0:
+ isRed = true;
+ break;
+ case 1:
+ isGreen = true;
+ break;
+ case 2:
+ isYellow = true;
+ break;
+ case 3:
+ isBlue = true;
+ break;
+ default:
+ break;
+ }
+ m_pfooter->AddIntToken(0 + button, isRed);
+ m_pfooter->AddIntToken(4 + button, isGreen);
+ m_pfooter->AddIntToken(8 + button, isYellow);
+ m_pfooter->AddIntToken(12 + button, isBlue);
+ }
m_pfooter->Display();
}
@@ -378,8 +375,8 @@ void cBrowserGrid::DrawScrollbar()
m_pScrollbar->Clear();
m_pScrollbar->ClearTokens();
- m_pScrollbar->AddIntToken("height", scrollBarHeight);
- m_pScrollbar->AddIntToken("offset", offset);
+ m_pScrollbar->AddIntToken((int)eTokenScrollbarInt::height, scrollBarHeight);
+ m_pScrollbar->AddIntToken((int)eTokenScrollbarInt::offset, offset);
m_pScrollbar->Display();
}
@@ -420,19 +417,19 @@ bool cBrowserGrid::DrawTime()
m_pWatch->Clear();
m_pWatch->ClearTokens();
- m_pWatch->AddIntToken("sec", sec);
- m_pWatch->AddIntToken("min", min);
- m_pWatch->AddIntToken("hour", hour);
- m_pWatch->AddIntToken("hmins", hourMinutes);
- m_pWatch->AddIntToken("year", now->tm_year + 1900);
- m_pWatch->AddIntToken("day", now->tm_mday);
- m_pWatch->AddStringToken("time", *TimeString(t));
- m_pWatch->AddStringToken("monthname", monthname);
- m_pWatch->AddStringToken("monthnameshort", monthshort);
- m_pWatch->AddStringToken("month", *cString::sprintf("%02d", now->tm_mon + 1));
- m_pWatch->AddStringToken("dayleadingzero", *cString::sprintf("%02d", now->tm_mday));
- m_pWatch->AddStringToken("dayname", *WeekDayNameFull(now->tm_wday));
- m_pWatch->AddStringToken("daynameshort", *WeekDayName(now->tm_wday));
+ m_pWatch->AddIntToken((int)eTokenTimeInt::sec, sec);
+ m_pWatch->AddIntToken((int)eTokenTimeInt::min, min);
+ m_pWatch->AddIntToken((int)eTokenTimeInt::hour, hour);
+ m_pWatch->AddIntToken((int)eTokenTimeInt::hmins, hourMinutes);
+ m_pWatch->AddIntToken((int)eTokenTimeInt::year, now->tm_year + 1900);
+ m_pWatch->AddIntToken((int)eTokenTimeInt::day, now->tm_mday);
+ m_pWatch->AddStringToken((int)eTokenTimeStr::time, *TimeString(t));
+ m_pWatch->AddStringToken((int)eTokenTimeStr::monthname, monthname);
+ m_pWatch->AddStringToken((int)eTokenTimeStr::monthnameshort, monthshort);
+ m_pWatch->AddStringToken((int)eTokenTimeStr::month, *cString::sprintf("%02d", now->tm_mon + 1));
+ m_pWatch->AddStringToken((int)eTokenTimeStr::dayleadingzero, *cString::sprintf("%02d", now->tm_mday));
+ m_pWatch->AddStringToken((int)eTokenTimeStr::dayname, *WeekDayNameFull(now->tm_wday));
+ m_pWatch->AddStringToken((int)eTokenTimeStr::daynameshort, *WeekDayName(now->tm_wday));
m_pWatch->Display();
m_lastsecond = sec;
@@ -456,8 +453,8 @@ cDummyElement::cDummyElement(std::string title)
void cDummyElement::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool clear, std::function<void(cGridElement*)> OnCached)
{
if(clear) grid->ClearTokens();
- grid->AddIntToken("isdummy", 1);
- grid->AddStringToken("title", m_title);
+ grid->AddIntToken((int)eTokenGridInt::isdummy, 1);
+ grid->AddStringToken((int)eTokenGridStr::title, m_title.c_str());
}
std::string cDummyElement::GetTitle()
@@ -479,13 +476,13 @@ cServerElement::cServerElement(plexclient::PlexServer* server, std::string start
void cServerElement::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool clear, std::function<void(cGridElement*)> OnCached)
{
if(clear) grid->ClearTokens();
- grid->AddIntToken("isserver", 1);
- grid->AddStringToken("title", m_pServer->GetServerName());
- grid->AddStringToken("serverstartpointname", m_sStartName);
- grid->AddStringToken("serverip", m_pServer->GetHost());
- grid->AddIntToken("serverport", m_pServer->GetPort());
- grid->AddStringToken("serverversion", m_pServer->GetVersion());
- grid->AddIntToken("viewmode", Config::GetInstance().DefaultViewMode);
+ grid->AddIntToken((int)eTokenGridInt::isserver, 1);
+ grid->AddStringToken((int)eTokenGridStr::title, m_pServer->GetServerName().c_str());
+ grid->AddStringToken((int)eTokenGridStr::serverstartpointname, m_sStartName.c_str());
+ grid->AddStringToken((int)eTokenGridStr::serverip, m_pServer->GetHost().c_str());
+ grid->AddIntToken((int)eTokenGridInt::serverport, m_pServer->GetPort());
+ grid->AddStringToken((int)eTokenGridStr::serverversion, m_pServer->GetVersion().c_str());
+ grid->AddIntToken((int)eTokenGridInt::viewmode, Config::GetInstance().DefaultViewMode);
}
std::string cServerElement::GetTitle()
diff --git a/plex.cpp b/plex.cpp
index 1d2aaa1..7a74c3d 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -3,6 +3,7 @@
#include "plex.h"
#include "plexOsd.h"
#include "services.h"
+#include "tokendefinitions.h"
#include <Poco/Net/SSLManager.h>
#include <Poco/SharedPtr.h>
@@ -31,9 +32,6 @@ bool cMyPlugin::PlayingFile = false;
*/
cMyPlugin::cMyPlugin(void)
{
-#ifdef SKINDESIGNER
- m_pSdCheck = NULL;
-#endif
}
/**
@@ -69,34 +67,57 @@ const char *cMyPlugin::Description(void)
bool cMyPlugin::Start(void)
{
#ifdef SKINDESIGNER
- skindesignerapi::cPluginStructure reg;
- reg.name = "plex";
- reg.libskindesignerAPIVersion = LIBSKINDESIGNERAPIVERSION;
-
- reg.SetView(viRootView, "root.xml");
- reg.SetViewGrid(eViews::viRootView, eViewGrids::vgCover, "coverbrowser");
- reg.SetViewGrid(eViews::viRootView, eViewGrids::vgList, "listbrowser");
- reg.SetViewGrid(eViews::viRootView, eViewGrids::vgDetail, "detailbrowser");
- reg.SetViewElement(viRootView, verHeader, "header");
- reg.SetViewElement(viRootView, verBackground, "background");
- reg.SetViewElement(viRootView, verInfopane, "infopane");
- reg.SetViewElement(viRootView, verFooter, "footer");
- reg.SetViewElement(viRootView, verWatch, "time");
- reg.SetViewElement(viRootView, verMessage, "message");
- reg.SetViewElement(viRootView, verScrollbar, "scrollbar");
- /*
- reg.SetSubView(viRootView, viDetailView, "detail.xml");
- reg.SetViewElement(viDetailView, vedBackground, "background");
- reg.SetViewElement(viDetailView, vedHeader, "header");
- reg.SetViewElement(viDetailView, vedFooter, "footer");
- */
-
- //reg.SetMenu(meRoot, "streamselect.xml");
- if (skindesignerapi::SkindesignerAPI::RegisterPlugin(&reg)) {
- m_pSdCheck = new cPlexSdOsd();
- cMyPlugin::bSkindesigner = m_pSdCheck->SdSupport();
+ m_pPlugStruct = new skindesignerapi::cPluginStructure();
+ m_pPlugStruct->name = "plex";
+ m_pPlugStruct->libskindesignerAPIVersion = LIBSKINDESIGNERAPIVERSION;
+
+ m_pPlugStruct->RegisterRootView("root.xml");
+ skindesignerapi::cTokenContainer *tkBackground = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::background, tkBackground);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::background, "background", tkBackground);
+
+ skindesignerapi::cTokenContainer *tkHeader = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::header, tkHeader);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::header, "header", tkHeader);
+
+ skindesignerapi::cTokenContainer *tkFooter = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::footer, tkFooter);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::footer, "footer", tkFooter);
+
+ skindesignerapi::cTokenContainer *tkInfopane = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::infopane, tkInfopane);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::infopane, "infopane", tkInfopane);
+
+ skindesignerapi::cTokenContainer *tkWatch = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::watch, tkWatch);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::watch, "watch", tkWatch);
+
+ skindesignerapi::cTokenContainer *tkMessage = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::message, tkMessage);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::message, "message", tkMessage);
+
+ skindesignerapi::cTokenContainer *tkScrollbar = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineTokens(eViewElementsRoot::scrollbar, tkScrollbar);
+ m_pPlugStruct->RegisterViewElement((int)eViews::rootView, (int)eViewElementsRoot::scrollbar, "scrollbar", tkScrollbar);
+
+ skindesignerapi::cTokenContainer *tkGridCover = new skindesignerapi::cTokenContainer();
+ skindesignerapi::cTokenContainer *tkGridDetail = new skindesignerapi::cTokenContainer();
+ skindesignerapi::cTokenContainer *tkGridList = new skindesignerapi::cTokenContainer();
+ cPlexSdOsd::DefineGridTokens(tkGridCover);
+ cPlexSdOsd::DefineGridTokens(tkGridDetail);
+ cPlexSdOsd::DefineGridTokens(tkGridList);
+ m_pPlugStruct->RegisterViewGrid((int)eViews::rootView, (int)eViewGrids::cover, "coverbrowser", tkGridCover);
+ m_pPlugStruct->RegisterViewGrid((int)eViews::rootView, (int)eViewGrids::detail, "detailbrowser", tkGridDetail);
+ m_pPlugStruct->RegisterViewGrid((int)eViews::rootView, (int)eViewGrids::list, "listbrowser", tkGridList);
+
+
+ if (!skindesignerapi::SkindesignerAPI::RegisterPlugin(m_pPlugStruct)) {
+ esyslog("[plex]: skindesigner not available");
+ bSkindesigner = false;
} else {
- esyslog("[plex]: %s skindesigner not available", __FUNCTION__);
+ dsyslog("[plex]: successfully registered at skindesigner, id %d", m_pPlugStruct->id);
+ m_pTestOsd = new cPlexSdOsd(m_pPlugStruct);
+ bSkindesigner = true;
}
#endif
return true;
@@ -153,7 +174,7 @@ cOsdObject *cMyPlugin::MainMenuAction(void)
{
//dsyslog("[plex]%s:\n", __FUNCTION__);
#ifdef SKINDESIGNER
- if(m_pSdCheck && m_pSdCheck->SdSupport()) return new cPlexSdOsd();
+ if(bSkindesigner && m_pTestOsd->SdSupport()) return new cPlexSdOsd(m_pPlugStruct);
else return cPlexMenu::ProcessMenu();
#else
return cPlexMenu::ProcessMenu();
diff --git a/plex.h b/plex.h
index b67c8ea..698b420 100644
--- a/plex.h
+++ b/plex.h
@@ -46,7 +46,8 @@ class cMyPlugin:public cPlugin
{
private:
#ifdef SKINDESIGNER
- cPlexSdOsd* m_pSdCheck;
+ skindesignerapi::cPluginStructure *m_pPlugStruct;
+ cPlexSdOsd *m_pTestOsd;
static bool bSkindesigner;
#endif
diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp
index 1d789d7..b078879 100644
--- a/plexSdOsd.cpp
+++ b/plexSdOsd.cpp
@@ -7,14 +7,15 @@
cMutex cPlexSdOsd::RedrawMutex;
-cPlexSdOsd::cPlexSdOsd()
+cPlexSdOsd::cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct) : cSkindesignerOsdObject(plugStruct)
{
m_pRootView = NULL;
}
cPlexSdOsd::~cPlexSdOsd()
{
- m_pRootView->Deactivate(true);
+ if(m_pRootView)
+ m_pRootView->Deactivate(true);
if(m_pBrowserGrid)
m_pBrowserGrid->Clear();
if(m_pMessage)
@@ -24,33 +25,30 @@ cPlexSdOsd::~cPlexSdOsd()
bool cPlexSdOsd::SdSupport()
{
- bool skinDesignerAvailable = InitSkindesignerInterface("plex");
- if (skinDesignerAvailable) {
-
- skindesignerapi::cOsdView *rootView = GetOsdView(eViews::viRootView);
+ if (SkindesignerAvailable()) {
+ skindesignerapi::cOsdView *rootView = GetOsdView();
if (!rootView) {
- esyslog("[plex]: used skindesigner skin does not support plex");
- return false;
+ esyslog("[plex]: used skindesigner skin does not support plex");
+ return false;
}
}
- return skinDesignerAvailable;
+ return true;
}
void cPlexSdOsd::Show(void)
{
- bool skinDesignerAvailable = InitSkindesignerInterface("plex");
- if (!skinDesignerAvailable) {
+ if (!SkindesignerAvailable()) {
return;
}
- m_pRootView = std::shared_ptr<skindesignerapi::cOsdView>(GetOsdView(eViews::viRootView));
+ m_pRootView = std::shared_ptr<skindesignerapi::cOsdView>(GetOsdView((int)eViews::rootView));
if (!m_pRootView) {
esyslog("[plex]: used skindesigner skin does not support plex");
return;
}
m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(new cBrowserGrid(m_pRootView));
- m_pMessage = std::shared_ptr<skindesignerapi::cViewElement>(m_pRootView->GetViewElement(eViewElementsRoot::verMessage));
+ m_pMessage = std::shared_ptr<skindesignerapi::cViewElement>(m_pRootView->GetViewElement((int)eViewElementsRoot::message));
m_messageDisplayed = false;
Flush();
}
@@ -167,8 +165,135 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key)
void cPlexSdOsd::DrawMessage(std::string message)
{
m_pMessage->ClearTokens();
- m_pMessage->AddStringToken("message", message);
- m_pMessage->AddIntToken("displaymessage", true);
+ m_pMessage->AddStringToken((int)eTokenMessageStr::message, message.c_str());
+ m_pMessage->AddIntToken((int)eTokenMessageInt::displaymessage, true);
m_pMessage->Display();
m_pRootView->Display();
}
+
+void cPlexSdOsd::DefineTokens(eViewElementsRoot ve, skindesignerapi::cTokenContainer* tk)
+{
+ switch(ve) {
+ case eViewElementsRoot::background:
+ tk->DefineIntToken("{viewmode}", (int)eTokenBackgroundInt::viewmode);
+ tk->DefineIntToken("{isdirectory}", (int)eTokenBackgroundInt::isdirectory);
+ tk->DefineStringToken("{selecteditembackground}", (int)eTokenBackgroundStr::selecteditembackground);
+ tk->DefineStringToken("{currentdirectorybackground}", (int)eTokenBackgroundStr::currentdirectorybackground);
+ break;
+ case eViewElementsRoot::infopane:
+ case eViewElementsRoot::header:
+ DefineGridTokens(tk);
+ tk->DefineStringToken("{tabname}", (int)eTokenGridStr::tabname);
+ break;
+ case eViewElementsRoot::footer:
+ tk->DefineIntToken("{red1}", (int)eTokenFooterInt::red1);
+ tk->DefineIntToken("{red2}", (int)eTokenFooterInt::red2);
+ tk->DefineIntToken("{red3}", (int)eTokenFooterInt::red3);
+ tk->DefineIntToken("{red4}", (int)eTokenFooterInt::red4);
+ tk->DefineIntToken("{green1}", (int)eTokenFooterInt::green1);
+ tk->DefineIntToken("{green2}", (int)eTokenFooterInt::green2);
+ tk->DefineIntToken("{green3}", (int)eTokenFooterInt::green3);
+ tk->DefineIntToken("{green4}", (int)eTokenFooterInt::green4);
+ tk->DefineIntToken("{yellow1}", (int)eTokenFooterInt::yellow1);
+ tk->DefineIntToken("{yellow2}", (int)eTokenFooterInt::yellow2);
+ tk->DefineIntToken("{yellow3}", (int)eTokenFooterInt::yellow3);
+ tk->DefineIntToken("{yellow4}", (int)eTokenFooterInt::yellow4);
+ tk->DefineIntToken("{blue1}", (int)eTokenFooterInt::blue1);
+ tk->DefineIntToken("{blue2}", (int)eTokenFooterInt::blue2);
+ tk->DefineIntToken("{blue3}", (int)eTokenFooterInt::blue3);
+ tk->DefineIntToken("{blue4}", (int)eTokenFooterInt::blue4);
+ tk->DefineStringToken("{red}", (int)eTokenFooterStr::red);
+ tk->DefineStringToken("{green}", (int)eTokenFooterStr::green);
+ tk->DefineStringToken("{yellow}", (int)eTokenFooterStr::yellow);
+ tk->DefineStringToken("{blue}", (int)eTokenFooterStr::blue);
+ break;
+ case eViewElementsRoot::watch:
+ tk->DefineIntToken("{sec}", (int)eTokenTimeInt::sec);
+ tk->DefineIntToken("{min}", (int)eTokenTimeInt::min);
+ tk->DefineIntToken("{hour}", (int)eTokenTimeInt::hour);
+ tk->DefineIntToken("{hmins}", (int)eTokenTimeInt::hmins);
+ tk->DefineIntToken("{day}", (int)eTokenTimeInt::day);
+ tk->DefineIntToken("{year}", (int)eTokenTimeInt::year);
+ tk->DefineStringToken("{time}", (int)eTokenTimeStr::time);
+ tk->DefineStringToken("{dayname}", (int)eTokenTimeStr::dayname);
+ tk->DefineStringToken("{daynameshort}", (int)eTokenTimeStr::daynameshort);
+ tk->DefineStringToken("{dayleadingzero}", (int)eTokenTimeStr::dayleadingzero);
+ tk->DefineStringToken("{month}", (int)eTokenTimeStr::month);
+ tk->DefineStringToken("{monthname}", (int)eTokenTimeStr::monthname);
+ tk->DefineStringToken("{monthnameshort}", (int)eTokenTimeStr::monthnameshort);
+ break;
+ case eViewElementsRoot::message:
+ tk->DefineIntToken("{displaymessage}", (int)eTokenMessageInt::displaymessage);
+ tk->DefineStringToken("{message}", (int)eTokenMessageStr::message);
+ break;
+ case eViewElementsRoot::scrollbar:
+ tk->DefineIntToken("{height}", (int)eTokenScrollbarInt::height);
+ tk->DefineIntToken("{offset}", (int)eTokenScrollbarInt::offset);
+ default:
+ break;
+ }
+}
+
+void cPlexSdOsd::DefineGridTokens(skindesignerapi::cTokenContainer* tk)
+{
+ tk->DefineIntToken("{viewmode}", (int)eTokenGridInt::viewmode);
+ tk->DefineIntToken("{viewgroup}", (int)eTokenGridInt::viewgroup);
+ tk->DefineIntToken("{viewCount}", (int)eTokenGridInt::viewCount);
+ tk->DefineIntToken("{viewoffset}", (int)eTokenGridInt::viewoffset);
+ tk->DefineIntToken("{viewoffsetpercent}", (int)eTokenGridInt::viewoffsetpercent);
+ tk->DefineIntToken("{duration}", (int)eTokenGridInt::duration);
+ tk->DefineIntToken("{year}", (int)eTokenGridInt::year);
+ tk->DefineIntToken("{hasthumb}", (int)eTokenGridInt::hasthumb);
+ tk->DefineIntToken("{hasart}", (int)eTokenGridInt::hasart);
+ tk->DefineIntToken("{ismovie}", (int)eTokenGridInt::ismovie);
+ tk->DefineIntToken("{isepisode}", (int)eTokenGridInt::isepisode);
+ tk->DefineIntToken("{isdirectory}", (int)eTokenGridInt::isdirectory);
+ tk->DefineIntToken("{isshow}", (int)eTokenGridInt::isshow);
+ tk->DefineIntToken("{isseason}", (int)eTokenGridInt::isseason);
+ tk->DefineIntToken("{originallyAvailableYear}", (int)eTokenGridInt::originallyAvailableYear);
+ tk->DefineIntToken("{originallyAvailableMonth}", (int)eTokenGridInt::originallyAvailableMonth);
+ tk->DefineIntToken("{originallyAvailableDay}", (int)eTokenGridInt::originallyAvailableDay);
+ tk->DefineIntToken("{season}", (int)eTokenGridInt::season);
+ tk->DefineIntToken("{episode}", (int)eTokenGridInt::episode);
+ tk->DefineIntToken("{leafCount}", (int)eTokenGridInt::leafCount);
+ tk->DefineIntToken("{viewedLeafCount}", (int)eTokenGridInt::viewedLeafCount);
+ tk->DefineIntToken("{childCount}", (int)eTokenGridInt::childCount);
+ tk->DefineIntToken("{rating}", (int)eTokenGridInt::rating);
+ tk->DefineIntToken("{hasseriesthumb}", (int)eTokenGridInt::hasseriesthumb);
+ tk->DefineIntToken("{hasbanner}", (int)eTokenGridInt::hasbanner);
+ tk->DefineIntToken("{columns}", (int)eTokenGridInt::columns);
+ tk->DefineIntToken("{rows}", (int)eTokenGridInt::rows);
+ tk->DefineIntToken("{position}", (int)eTokenGridInt::position);
+ tk->DefineIntToken("{totalcount}", (int)eTokenGridInt::totalcount);
+ tk->DefineIntToken("{bitrate}", (int)eTokenGridInt::bitrate);
+ tk->DefineIntToken("{width}", (int)eTokenGridInt::width);
+ tk->DefineIntToken("{height}", (int)eTokenGridInt::height);
+ tk->DefineIntToken("{audioChannels}", (int)eTokenGridInt::audioChannels);
+ tk->DefineIntToken("{isdummy}", (int)eTokenGridInt::isdummy);
+ tk->DefineIntToken("{isserver}", (int)eTokenGridInt::isserver);
+ tk->DefineIntToken("{serverport}", (int)eTokenGridInt::serverport);
+
+ tk->DefineStringToken("{title}", (int)eTokenGridStr::title);
+ tk->DefineStringToken("{orginaltitle}", (int)eTokenGridStr::orginaltitle);
+ tk->DefineStringToken("{summary}", (int)eTokenGridStr::summary);
+ tk->DefineStringToken("{contentrating}", (int)eTokenGridStr::contentrating);
+ tk->DefineStringToken("{ratingstring}", (int)eTokenGridStr::ratingstring);
+ tk->DefineStringToken("{studio}", (int)eTokenGridStr::studio);
+ tk->DefineStringToken("{thumb}", (int)eTokenGridStr::thumb);
+ tk->DefineStringToken("{art}", (int)eTokenGridStr::art);
+ tk->DefineStringToken("{seriestitle}", (int)eTokenGridStr::seriestitle);
+ tk->DefineStringToken("{seriesthumb}", (int)eTokenGridStr::seriesthumb);
+ tk->DefineStringToken("{banner}", (int)eTokenGridStr::banner);
+ tk->DefineStringToken("{videoResolution}", (int)eTokenGridStr::videoResolution);
+ tk->DefineStringToken("{aspectRatio}", (int)eTokenGridStr::aspectRatio);
+ tk->DefineStringToken("{audioCodec}", (int)eTokenGridStr::audioCodec);
+ tk->DefineStringToken("{videoCodec}", (int)eTokenGridStr::videoCodec);
+ tk->DefineStringToken("{container}", (int)eTokenGridStr::container);
+ tk->DefineStringToken("{videoFrameRate}", (int)eTokenGridStr::videoFrameRate);
+ tk->DefineStringToken("{serverstartpointname}", (int)eTokenGridStr::serverstartpointname);
+ tk->DefineStringToken("{serverip}", (int)eTokenGridStr::serverip);
+ tk->DefineStringToken("{serverversion}", (int)eTokenGridStr::serverversion);
+
+ tk->DefineLoopToken("{roles[actor]}", (int)eTokenGridActorLst::roles);
+ tk->DefineLoopToken("{genres[genre]}", (int)eTokenGridGenresLst::genres);
+}
diff --git a/plexSdOsd.h b/plexSdOsd.h
index bacf3dc..0899869 100644
--- a/plexSdOsd.h
+++ b/plexSdOsd.h
@@ -17,36 +17,10 @@
#include "hlsPlayerControl.h"
#include "browserGrid.h"
+#include "tokendefinitions.h"
#include <libskindesignerapi/osdelements.h>
#include <libskindesignerapi/skindesignerosdbase.h>
-enum eViews {
- viRootView,
- viDetailView
-};
-
-enum eViewElementsRoot {
- verBackground,
- verHeader,
- verFooter,
- verInfopane,
- verWatch,
- verMessage,
- verScrollbar
-};
-
-enum eViewGrids {
- vgCover,
- vgDetail,
- vgList
-};
-
-enum eViewElementsDetail {
- vedBackground,
- vedHeader,
- vedFooter
-};
-
class cPlexSdOsd : public skindesignerapi::cSkindesignerOsdObject
{
private:
@@ -63,13 +37,15 @@ private:
void DrawMessage(std::string message);
public:
- cPlexSdOsd();
+ cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct);
~cPlexSdOsd();
virtual void Show(void);
virtual eOSState ProcessKey(eKeys Key);
bool SdSupport();
static cMutex RedrawMutex;
+ static void DefineTokens(eViewElementsRoot ve, skindesignerapi::cTokenContainer *tk);
+ static void DefineGridTokens(skindesignerapi::cTokenContainer *tk);
};
#endif // CPLEXSDOSD_H
diff --git a/po/de_DE.po b/po/de_DE.po
index 9799f01..c80f352 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-plex 0.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2016-01-14 20:01+0100\n"
+"POT-Creation-Date: 2016-02-13 20:52+0100\n"
"PO-Revision-Date: 2016-01-14 20:20+0200\n"
"Last-Translator: Chris <zerov83@gmail.com>\n"
"Language-Team: chriszero\n"
diff --git a/templates/plug-plex-root.xml b/templates/plug-plex-root.xml
index 3f9c479..a6c3e30 100644
--- a/templates/plug-plex-root.xml
+++ b/templates/plug-plex-root.xml
@@ -44,6 +44,9 @@
<viewelement name="header">
</viewelement>
+ <viewelement name="infopane">
+ </viewelement>
+
<!-- Tokens available for scrollbar
{height} height of the position marker of the scrollbar in percent
{offset} offset for the position marker from the top of the scrollbar in percent
@@ -57,9 +60,6 @@
-->
</viewelement>
- <viewelement name="infopane">
- </viewelement>
-
<!-- Tokens available in browser
{totalcount} int: total number of grid elements
{position} int: absolute position of grid element
diff --git a/tokendefinitions.h b/tokendefinitions.h
new file mode 100644
index 0000000..52f17cd
--- /dev/null
+++ b/tokendefinitions.h
@@ -0,0 +1,171 @@
+#ifndef __TOKENDEFINITIONS_H
+#define __TOKENDEFINITIONS_H
+
+enum class eViews {
+ rootView,
+ detailView
+};
+
+enum class eViewElementsRoot {
+ background,
+ header,
+ footer,
+ infopane,
+ watch,
+ message,
+ scrollbar
+};
+
+enum class eViewGrids {
+ cover,
+ detail,
+ list
+};
+
+enum class eViewElementsDetail {
+ background,
+ header,
+ footer
+};
+
+enum class eTokenGridInt {
+ viewmode = 0,
+ viewgroup,
+ viewCount,
+ viewoffset,
+ viewoffsetpercent,
+ duration,
+ year,
+ hasthumb,
+ hasart,
+ ismovie,
+ isepisode,
+ isdirectory,
+ isshow,
+ isseason,
+ originallyAvailableYear,
+ originallyAvailableMonth,
+ originallyAvailableDay,
+ season,
+ episode,
+ leafCount,
+ viewedLeafCount,
+ childCount,
+ rating,
+ hasseriesthumb,
+ hasbanner,
+ columns,
+ rows,
+ position,
+ totalcount,
+ bitrate,
+ width,
+ height,
+ audioChannels,
+ isdummy,
+ isserver,
+ serverport
+};
+
+enum class eTokenGridStr {
+ title = 0,
+ orginaltitle,
+ summary,
+ contentrating,
+ ratingstring,
+ studio,
+ thumb,
+ art,
+ seriestitle,
+ seriesthumb,
+ banner,
+ videoResolution,
+ aspectRatio,
+ audioCodec,
+ videoCodec,
+ container,
+ videoFrameRate,
+ serverstartpointname,
+ serverip,
+ serverversion,
+ tabname
+};
+
+enum class eTokenGridActorLst {
+ roles = 0
+};
+
+enum class eTokenGridGenresLst {
+ genres = 0
+};
+
+enum class eTokenMessageInt {
+ displaymessage = 0
+};
+
+enum class eTokenMessageStr {
+ message = 0
+};
+
+enum class eTokenScrollbarInt {
+ height = 0,
+ offset
+};
+
+enum class eTokenBackgroundInt {
+ viewmode = 0,
+ isdirectory
+};
+
+enum class eTokenBackgroundStr {
+ selecteditembackground = 0,
+ currentdirectorybackground
+};
+
+enum class eTokenTimeInt {
+ sec = 0,
+ min,
+ hour,
+ hmins,
+ day,
+ year
+};
+
+enum class eTokenTimeStr {
+ time = 0,
+ dayname,
+ daynameshort,
+ dayleadingzero,
+ month,
+ monthname,
+ monthnameshort
+};
+
+enum class eTokenFooterInt {
+ red1 = 0,
+ red2,
+ red3,
+ red4,
+ green1,
+ green2,
+ green3,
+ green4,
+ yellow1,
+ yellow2,
+ yellow3,
+ yellow4,
+ blue1,
+ blue2,
+ blue3,
+ blue4
+};
+
+enum class eTokenFooterStr {
+ red = 0,
+ green,
+ yellow,
+ blue
+};
+
+
+#endif //__TOKENDEFINITIONS_H \ No newline at end of file
diff --git a/viewGridNavigator.cpp b/viewGridNavigator.cpp
index 95de102..33619ba 100644
--- a/viewGridNavigator.cpp
+++ b/viewGridNavigator.cpp
@@ -2,6 +2,7 @@
#include <iostream>
#include "plexSdOsd.h"
#include "pictureCache.h"
+#include "tokendefinitions.h"
unsigned int cGridElement::AbsoluteGridIdCounter = 0;
@@ -44,8 +45,8 @@ void cViewGridNavigator::ReDraw(cGridElement* element)
double x, y;
element->GetPosition(x, y);
element->AddTokens(m_pGrid);
- m_pGrid->AddIntToken("columns", m_columns);
- m_pGrid->AddIntToken("rows", m_rows);
+ m_pGrid->AddIntToken((int)eTokenGridInt::columns, m_columns);
+ m_pGrid->AddIntToken((int)eTokenGridInt::rows, m_rows);
double width = 1.0 / m_columns;
double height = 1.0 / m_rows;
m_pGrid->SetGrid(element->GridElementId(), x, y, width, height);
@@ -116,10 +117,10 @@ void cViewGridNavigator::SetGridElementData(cGridElement *obj)
obj->SetPosition(x, y);
obj->AddTokens(m_pGrid, true, std::bind(&cViewGridNavigator::ReDraw, this, std::placeholders::_1));
// set GridDimensions
- m_pGrid->AddIntToken("columns", m_columns);
- m_pGrid->AddIntToken("rows", m_rows);
- m_pGrid->AddIntToken("position", obj->AbsolutePosition);
- m_pGrid->AddIntToken("totalcount", m_vElements.size());
+ m_pGrid->AddIntToken((int)eTokenGridInt::columns, m_columns);
+ m_pGrid->AddIntToken((int)eTokenGridInt::rows, m_rows);
+ m_pGrid->AddIntToken((int)eTokenGridInt::position, obj->AbsolutePosition);
+ m_pGrid->AddIntToken((int)eTokenGridInt::totalcount, m_vElements.size());
m_pGrid->SetGrid(obj->GridElementId(), x, y, width, height);
obj->InitFinished();
} else {
diff --git a/viewHeader.cpp b/viewHeader.cpp
index 15cb2c3..5d7c4ec 100644
--- a/viewHeader.cpp
+++ b/viewHeader.cpp
@@ -1,4 +1,5 @@
#include "viewHeader.h"
+#include "tokendefinitions.h"
cViewHeader::cViewHeader(skindesignerapi::cViewElement* viewElem)
{
@@ -17,27 +18,6 @@ void cViewHeader::Draw(cGridElement* elem)
elem->AddTokens(m_pViewElem, false);
- switch(m_eCurrentTab) {
- case ePlexMenuTab::pmtOnDeck:
- m_pViewElem->AddIntToken("istab1active", 1);
- m_pViewElem->AddIntToken("istab2active", 0);
- m_pViewElem->AddIntToken("istab3active", 0);
- m_pViewElem->AddStringToken("tab1name", tr("On Deck"));
- break;
- case ePlexMenuTab::pmtRecentlyAdded:
- m_pViewElem->AddIntToken("istab1active", 0);
- m_pViewElem->AddIntToken("istab2active", 1);
- m_pViewElem->AddIntToken("istab3active", 0);
- m_pViewElem->AddStringToken("tab2name", tr("Recently Added"));
- break;
- case ePlexMenuTab::pmtLibrary:
- m_pViewElem->AddIntToken("istab1active", 0);
- m_pViewElem->AddIntToken("istab2active", 0);
- m_pViewElem->AddIntToken("istab3active", 1);
- m_pViewElem->AddStringToken("tab3name", tr("Library"));
- break;
- }
-
m_pViewElem->Display();
}