summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-04-05 13:31:04 +0200
committerchriszero <zerov83@gmail.com>2015-04-05 13:31:04 +0200
commitf7f62b7ff1f12c1563a04560ad87d2f92a3e0af9 (patch)
tree4dd38d637ad2d5427c93a8d8d695e91c11df33d4
parent21ee9e67ff7029c099c9fd772d3dc3e23c955199 (diff)
downloadvdr-plugin-plex-f7f62b7ff1f12c1563a04560ad87d2f92a3e0af9.tar.gz
vdr-plugin-plex-f7f62b7ff1f12c1563a04560ad87d2f92a3e0af9.tar.bz2
More Skindesigner support.
Define a custom server
-rw-r--r--Config.cpp14
-rw-r--r--Config.h6
-rw-r--r--MediaContainer.cpp1
-rw-r--r--MediaContainer.h1
-rw-r--r--PVideo.cpp33
-rw-r--r--PVideo.h12
-rw-r--r--browserGrid.cpp132
-rw-r--r--browserGrid.h15
-rw-r--r--plex.cpp5
-rw-r--r--plexSdOsd.cpp125
-rw-r--r--plexSdOsd.h5
-rw-r--r--plexgdm.cpp13
-rw-r--r--plexgdm.h1
-rw-r--r--skins/blackhole/xmlfiles/plug-plex-root.xml6
-rw-r--r--viewGridNavigator.cpp5
-rw-r--r--viewGridNavigator.h12
16 files changed, 225 insertions, 161 deletions
diff --git a/Config.cpp b/Config.cpp
index 0dc889c..df577aa 100644
--- a/Config.cpp
+++ b/Config.cpp
@@ -65,6 +65,9 @@ cMyMenuSetupPage::cMyMenuSetupPage(void)
strn0cpy(Username, Config::GetInstance().s_username.c_str(), STRING_SIZE);
strn0cpy(Password, Config::GetInstance().s_password.c_str(), STRING_SIZE);
strn0cpy(Uuid, Config::GetInstance().GetUUID().c_str(), STRING_SIZE);
+ strn0cpy(ServerHost, Config::GetInstance().s_serverHost.c_str(), STRING_SIZE);
+ ServerPort = Config::GetInstance().ServerPort;
+ UseConfiguredServer = Config::GetInstance().UseConfiguredServer;
HideMainMenuEntry = Config::GetInstance().HideMainMenuEntry;
UseCustomTranscodeProfile = Config::GetInstance().UseCustomTranscodeProfile;
@@ -73,6 +76,11 @@ cMyMenuSetupPage::cMyMenuSetupPage(void)
Add(new cMenuEditBoolItem(tr("Use Plex account"), (int*)&UsePlexAccount, trVDR("no"), trVDR("yes")));
Add(new cMenuEditStrItem(tr("Plex Username"), Username, STRING_SIZE));
Add(new cMenuEditStrItem(tr("Plex Password"), Password, STRING_SIZE));
+
+ Add(new cMenuEditBoolItem(tr("Use Custom Server"), (int*)&UseConfiguredServer, trVDR("no"), trVDR("yes")));
+ Add(new cMenuEditStrItem(tr("Server Host"), ServerHost, STRING_SIZE));
+ Add(new cMenuEditIntItem(tr("Server Port"), &ServerPort));
+
cMenuEditStrItem* devUUID = new cMenuEditStrItem(tr("Current UUID"), Uuid, STRING_SIZE);
devUUID->SetSelectable(false);
Add(devUUID);
@@ -88,6 +96,9 @@ void cMyMenuSetupPage::Store(void)
Config::GetInstance().HideMainMenuEntry = HideMainMenuEntry;
Config::GetInstance().UseCustomTranscodeProfile = UseCustomTranscodeProfile;
Config::GetInstance().UsePlexAccount = UsePlexAccount;
+ Config::GetInstance().UseConfiguredServer = UseConfiguredServer;
+ Config::GetInstance().s_serverHost = std::string(ServerHost);
+ Config::GetInstance().ServerPort = ServerPort;
SetupStore("UseCustomTranscodeProfile", Config::GetInstance().UseCustomTranscodeProfile);
SetupStore("HideMainMenuEntry", Config::GetInstance().HideMainMenuEntry);
@@ -95,4 +106,7 @@ void cMyMenuSetupPage::Store(void)
SetupStore("Username", Config::GetInstance().s_username.c_str());
SetupStore("Password", Config::GetInstance().s_password.c_str());
SetupStore("UUID", Config::GetInstance().GetUUID().c_str());
+ SetupStore("UseConfiguredServer", Config::GetInstance().UseConfiguredServer);
+ SetupStore("ServerHost", Config::GetInstance().s_serverHost.c_str());
+ SetupStore("ServerPort", Config::GetInstance().ServerPort);
} \ No newline at end of file
diff --git a/Config.h b/Config.h
index 21b9b94..39ee8ad 100644
--- a/Config.h
+++ b/Config.h
@@ -26,10 +26,13 @@ public:
std::string s_username;
std::string s_password;
+ std::string s_serverHost;
+ int ServerPort;
bool HideMainMenuEntry;
bool UseCustomTranscodeProfile;
bool UsePlexAccount;
+ bool UseConfiguredServer;
std::string GetUUID();
void SetUUID(const char* uuid);
@@ -59,6 +62,9 @@ class cMyMenuSetupPage:public cMenuSetupPage
char Username[STRING_SIZE];
char Password[STRING_SIZE];
char Uuid[STRING_SIZE];
+ char ServerHost[STRING_SIZE];
+ int ServerPort;
+ int UseConfiguredServer;
int HideMainMenuEntry;
int UseCustomTranscodeProfile;
int UsePlexAccount;
diff --git a/MediaContainer.cpp b/MediaContainer.cpp
index d567dec..c902be2 100644
--- a/MediaContainer.cpp
+++ b/MediaContainer.cpp
@@ -22,6 +22,7 @@ MediaContainer::MediaContainer(std::istream* response, PlexServer* Server)
m_sTitle2 = GetNodeValue(pAttribs->getNamedItem("title2"));
m_iParentIndex = GetNodeValueAsInt(pAttribs->getNamedItem("parentIndex"));
m_sThumb = GetNodeValue(pAttribs->getNamedItem("thumb"));
+ m_sBanner = GetNodeValue(pAttribs->getNamedItem("banner"));
m_sViewGroup = GetNodeValue(pAttribs->getNamedItem("viewGroup"));
m_sLibrarySectionTitle = GetNodeValue(pAttribs->getNamedItem("librarySectionTitle"));
m_sLibrarySectionUUID = GetNodeValue(pAttribs->getNamedItem("librarySectionUUID"));
diff --git a/MediaContainer.h b/MediaContainer.h
index 9f7ca89..d806fd3 100644
--- a/MediaContainer.h
+++ b/MediaContainer.h
@@ -48,6 +48,7 @@ public:
bool m_bAllowSync;
std::string m_sArt;
std::string m_sThumb;
+ std::string m_sBanner;
std::string m_sTitle;
std::string m_sTitle1;
std::string m_sTitle2;
diff --git a/PVideo.cpp b/PVideo.cpp
index ca8684b..25ed234 100644
--- a/PVideo.cpp
+++ b/PVideo.cpp
@@ -18,6 +18,7 @@ Video::Video(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* parent)
m_pServer = Server;
Parse(pNode);
+ m_pParent = parent;
if (m_iParentIndex < 0) {
m_iParentIndex = parent->m_iParentIndex;
}
@@ -84,6 +85,7 @@ void Video::Parse(Poco::XML::Node* pNode)
m_tType = GetNodeValueAsMediaType(pAttribs->getNamedItem("type"));
m_sTitle = GetNodeValue(pAttribs->getNamedItem("title"));
m_sOriginalTitle = GetNodeValue(pAttribs->getNamedItem("originalTitle"));
+ m_sGrandparentTitle = GetNodeValue(pAttribs->getNamedItem("grandparentTitle"));
m_sContentRating = GetNodeValue(pAttribs->getNamedItem("contentRating"));
m_sSummary = GetNodeValue(pAttribs->getNamedItem("summary"));
m_lViewoffset = GetNodeValueAsLong(pAttribs->getNamedItem("viewOffset"));
@@ -91,6 +93,8 @@ void Video::Parse(Poco::XML::Node* pNode)
m_iYear = GetNodeValueAsInt(pAttribs->getNamedItem("year"));
m_sThumb = GetNodeValue(pAttribs->getNamedItem("thumb"));
m_sArt = GetNodeValue(pAttribs->getNamedItem("art"));
+ m_sGrandparentThumb = GetNodeValue(pAttribs->getNamedItem("grandparentThumb"));
+ m_sGrandparentArt = GetNodeValue(pAttribs->getNamedItem("grandparentArt"));
m_iDuration = GetNodeValueAsLong(pAttribs->getNamedItem("duration"));
m_tAddedAt = GetNodeValueAsTimeStamp(pAttribs->getNamedItem("addedAt"));
m_tUpdatedAt = GetNodeValueAsTimeStamp(pAttribs->getNamedItem("updatedAt"));
@@ -123,8 +127,7 @@ std::string Video::GetTitle()
case MOVIE:
if(m_iYear > 0) {
res = Poco::format("%s (%d)", m_sTitle, m_iYear);
- }
- else {
+ } else {
res = m_sTitle;
}
break;
@@ -185,7 +188,7 @@ bool Video::SetUnwatched()
bool Video::SetWatched()
{
- try {
+ try {
Poco::Net::HTTPClientSession session(m_pServer->GetIpAdress(), m_pServer->GetPort());
std::string uri = Poco::format("/:/scrobble?key=%d&identifier=com.plexapp.plugins.library", m_iRatingKey);
@@ -210,11 +213,32 @@ void Video::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::functi
{
if(clear) grid->ClearTokens();
grid->AddStringToken("title", m_sTitle);
- grid->AddIntToken("ismovie", 1);
+
bool cached = false;
cPictureCache::GetInstance().GetPath(ArtUri(), 1920, 1080, cached);
std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), 1280, 720, cached, OnCached, this);
if (cached) grid->AddStringToken("thumb", thumb);
+
+ if(m_tType == MediaType::MOVIE) {
+ grid->AddIntToken("ismovie", true);
+ }
+
+ if(m_tType == MediaType::EPISODE) {
+ grid->AddIntToken("isepisode", true);
+ cached = false;
+ std::string grandparentThumb = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_sGrandparentThumb, 1280, 720, cached, OnCached, this);
+ if (cached) grid->AddStringToken("grandparentthumb", grandparentThumb);
+ grid->AddStringToken("grandparenttitle", m_sGrandparentTitle);
+
+ if(m_pParent && !m_pParent->m_sBanner.empty()) {
+ cached = false;
+ std::string banner = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_pParent->m_sBanner, 1280, 720, cached, OnCached, this);
+ if(cached) {
+ grid->AddIntToken("hasbanner", true);
+ grid->AddStringToken("banner", banner);
+ }
+ }
+ }
}
std::string Video::ArtUri()
@@ -228,4 +252,3 @@ std::string Video::ThumbUri()
}
} // Namespace
-
diff --git a/PVideo.h b/PVideo.h
index 7c04bd4..b55b537 100644
--- a/PVideo.h
+++ b/PVideo.h
@@ -34,12 +34,13 @@ using Poco::Exception;
namespace plexclient
{
class MediaContainer;
-
+
class Video: private XmlObject, public cGridElement
{
private:
+ MediaContainer* m_pParent;
void Parse(Poco::XML::Node* pNode);
-
+
public:
Video(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* parent);
Video() {};
@@ -51,13 +52,16 @@ public:
MediaType m_tType;
std::string m_sTitle;
std::string m_sOriginalTitle;
+ std::string m_sGrandparentTitle;
std::string m_sContentRating;
std::string m_sSummary;
long m_lViewoffset;
Poco::Timestamp m_tLastViewedAt;
int m_iYear;
std::string m_sThumb;
+ std::string m_sGrandparentThumb;
std::string m_sArt;
+ std::string m_sGrandparentArt;
long m_iDuration;
int m_iViewCount;
Poco::Timestamp m_tAddedAt;
@@ -74,7 +78,7 @@ public:
int m_iMyPlayOffset;
int m_iIndex;
int m_iParentIndex;
-
+
virtual std::string GetTitle();
bool SetStream(Stream* stream);
bool UpdateFromServer();
@@ -82,7 +86,7 @@ public:
bool SetUnwatched();
std::string ThumbUri();
std::string ArtUri();
-
+
// gridElement
virtual void AddTokens(std::shared_ptr<cOsdElement> grid, bool clear = true, std::function<void(cGridElement*)> OnCached = NULL);
};
diff --git a/browserGrid.cpp b/browserGrid.cpp
index 0fef1eb..0ce3fcc 100644
--- a/browserGrid.cpp
+++ b/browserGrid.cpp
@@ -6,25 +6,49 @@
#include "plex.h"
#include "pictureCache.h"
-cBrowserGrid::cBrowserGrid(cViewGrid* viewGrid) : cViewGridNavigator(viewGrid)
+cBrowserGrid::cBrowserGrid(cOsdView* rootView) : cViewGridNavigator(rootView, rootView->GetViewGrid(eViewGrids::vgBrowser) )
{
+ m_pBackground = std::shared_ptr<cViewElement>(rootView->GetViewElement(eViewElementsRoot::verBackground));
+ m_pViewHeader = std::shared_ptr<cViewHeader>( new cViewHeader(rootView->GetViewElement(eViewElementsRoot::verHeader)));
+ m_pfooter = std::shared_ptr<cViewElement>(rootView->GetViewElement(eViewElementsRoot::verFooter));
+
m_rows = 2;
m_columns = 5;
m_pService = NULL;
m_pContainer = NULL;
- m_bServersAreRoot = true;
- SetServerElements();
- ProcessData();
+ //SwitchGrid(m_pViewHeader->CurrentTab());
+}
+
+void cBrowserGrid::Flush()
+{
+ //cMutexLock MutexLock(&cPlexSdOsd::RedrawMutex);
+ m_pGrid->Display();
+ m_pRootView->Display();
}
-cBrowserGrid::cBrowserGrid(cViewGrid* viewGrid, std::shared_ptr<plexclient::Plexservice> service) : cViewGridNavigator(viewGrid)
+void cBrowserGrid::SwitchGrid(ePlexMenuTab currentTab)
{
- m_rows = 2;
- m_columns = 5;
- m_bServersAreRoot = false;
- m_pService = service;
- m_pContainer = m_pService->GetSection(m_pService->StartUri);
- ProcessData();
+ if(currentTab == ePlexMenuTab::pmtOnDeck) {
+ std::cout << "OnDeck" << std::endl;
+ m_pService = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetFirstServer(), "/library/onDeck" ) );
+ m_pContainer = m_pService->GetSection(m_pService->StartUri);
+ ProcessData();
+
+ } else if(currentTab == ePlexMenuTab::pmtRecentlyAdded) {
+ std::cout << "Recently Added" << std::endl;
+ m_pService = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetFirstServer(), "/library/recentlyAdded" ) );
+ m_pContainer = m_pService->GetSection(m_pService->StartUri);
+ ProcessData();
+
+ } else if(currentTab == ePlexMenuTab::pmtLibrary) {
+ std::cout << "Lib" << std::endl;
+ //Server View
+ m_pService = NULL;
+ m_pContainer = NULL;
+ m_bServersAreRoot = true;
+ SetServerElements();
+ ProcessData();
+ }
}
void cBrowserGrid::SetServerElements()
@@ -67,7 +91,7 @@ void cBrowserGrid::ProcessData()
// Cache Images
//m_pContainer->PreCache();
}
-
+
m_firstElementIter = m_vElements.begin();
m_pGrid->Clear();
@@ -93,8 +117,7 @@ eOSState cBrowserGrid::NavigateSelect()
} else if(plexclient::Video* vid = dynamic_cast<plexclient::Video*>(SelectedObject())) {
cMyPlugin::PlayFile(*vid);
return eOSState::osEnd;
- }
- else return eOSState::osEnd;
+ } else return eOSState::osEnd;
}
eOSState cBrowserGrid::NavigateBack()
@@ -118,6 +141,87 @@ eOSState cBrowserGrid::NavigateBack()
return eOSState::osEnd;
}
+void cBrowserGrid::DrawGrid()
+{
+ DrawBackground();
+ DrawFooter();
+}
+
+void cBrowserGrid::DrawBackground()
+{
+ m_pBackground->ClearTokens();
+
+ if(auto video = dynamic_cast<plexclient::Video*>(SelectedObject()) ) {
+ bool cached = false;
+ std::string path = cPictureCache::GetInstance().GetPath(video->ArtUri(), 1920, 1080, cached);
+ m_pBackground->AddStringToken("selecteditembackground", path);
+ }
+
+ m_pBackground->AddIntToken("isdirectory", 1);
+ m_pBackground->AddStringToken("currentdirectorybackground", "/path");
+}
+
+void cBrowserGrid::DrawFooter()
+{
+ //if (!active)
+ // return;
+
+ string textGreen = tr("Prev. Tab");
+ string textYellow = tr("Next Tab");
+ string textRed = "";
+ string textBlue = "";
+
+ if(auto vid = dynamic_cast<plexclient::Video*>(SelectedObject()) ) {
+ if(vid->m_iViewCount > 0) textRed = tr("Unscrobble");
+ else textRed = tr("Scrobble");
+ textBlue = tr("Info");
+ }
+
+
+ int colorKeys[4] = { Setup.ColorKey0, Setup.ColorKey1, Setup.ColorKey2, Setup.ColorKey3 };
+
+ 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->Display();
+}
+
/*
* cDummyElement
*/
diff --git a/browserGrid.h b/browserGrid.h
index 30ada77..b91c30c 100644
--- a/browserGrid.h
+++ b/browserGrid.h
@@ -8,6 +8,7 @@
#include "plexgdm.h"
#include "PlexServer.h"
#include "viewGridNavigator.h"
+#include "viewHeader.h"
#include "libskindesigner/osdelements.h"
class cDummyElement : public cGridElement
@@ -34,6 +35,11 @@ public:
class cBrowserGrid : public cViewGridNavigator
{
private:
+ std::shared_ptr<cViewHeader> m_pViewHeader;
+ std::shared_ptr<cViewElement> m_pBackground;
+ std::shared_ptr<cViewElement> m_pfooter;
+ std::shared_ptr<cViewElement> m_pScrollbar;
+
bool m_bServersAreRoot;
std::vector<cServerElement> m_vServerElements;
std::shared_ptr<plexclient::MediaContainer> m_pContainer;
@@ -42,14 +48,19 @@ private:
void ProcessData();
void SetServerElements();
+ void DrawFooter();
+ void DrawBackground();
public:
- cBrowserGrid(cViewGrid* viewGrid);
- cBrowserGrid(cViewGrid* viewGrid, std::shared_ptr<plexclient::Plexservice> service);
+ cBrowserGrid(cOsdView* rootView);
+ //cBrowserGrid(cViewGrid* viewGrid, std::shared_ptr<plexclient::Plexservice> service);
std::shared_ptr<plexclient::MediaContainer> MediaContainer() { return m_pContainer; }
+ void DrawGrid();
+ void SwitchGrid(ePlexMenuTab currentTab);
virtual eOSState NavigateSelect();
virtual eOSState NavigateBack();
+ virtual void Flush();
};
#endif // CBROWSERGRID_H
diff --git a/plex.cpp b/plex.cpp
index b03ae75..fc84f99 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -66,7 +66,7 @@ bool cMyPlugin::Start(void)
reg.SetViewElement(viRootView, verBackground, "background");
reg.SetViewElement(viRootView, verFooter, "footer");
- reg.SetSubView(viRootView, viDetailView, "detail.xml");
+ //reg.SetSubView(viRootView, viDetailView, "detail.xml");
static cPlugin *pSkinDesigner = cPluginManager::GetPlugin("skindesigner");
if (pSkinDesigner) {
@@ -157,6 +157,9 @@ bool cMyPlugin::SetupParse(const char *name, const char *value)
else if (strcasecmp(name, "Username") == 0) Config::GetInstance().s_username = std::string(value);
else if (strcasecmp(name, "Password") == 0) Config::GetInstance().s_password = std::string(value);
else if (strcasecmp(name, "UUID") == 0) Config::GetInstance().SetUUID(value);
+ else if (strcasecmp(name, "UseConfiguredServer") == 0) Config::GetInstance().UseConfiguredServer = atoi(value) ? true : false;
+ else if (strcasecmp(name, "ServerHost") == 0) Config::GetInstance().s_serverHost = std::string(value);
+ else if (strcasecmp(name, "ServerPort") == 0) Config::GetInstance().ServerPort = atoi(value);
else return false;
return true;
diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp
index 843eafa..0379dd7 100644
--- a/plexSdOsd.cpp
+++ b/plexSdOsd.cpp
@@ -21,43 +21,16 @@ void cPlexSdOsd::Show(void)
esyslog("[plex]: used skindesigner skin does not support plex");
return;
}
- m_pBackground = std::shared_ptr<cViewElement>(m_pRootView->GetViewElement(eViewElementsRoot::verBackground));
-
- m_pViewHeader = std::shared_ptr<cViewHeader>(
- new cViewHeader(m_pRootView->GetViewElement(eViewElementsRoot::verHeader))
- );
- m_pfooter = std::shared_ptr<cViewElement>(m_pRootView->GetViewElement(eViewElementsRoot::verFooter));
-
- SwitchGrid(m_pViewHeader->CurrentTab());
-
+
+ m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(new cBrowserGrid(m_pRootView));
+ m_pBrowserGrid->SwitchGrid(ePlexMenuTab::pmtOnDeck);
Flush();
}
void cPlexSdOsd::Flush()
{
- cMutexLock MutexLock(&cPlexSdOsd::RedrawMutex);
- DrawBackground();
- m_pViewHeader->Draw(m_pBrowserGrid->SelectedObject());
-
- m_pBackground->Display();
-
+ m_pBrowserGrid->DrawGrid();
m_pBrowserGrid->Flush();
-
- m_pRootView->Display();
-}
-
-void cPlexSdOsd::DrawBackground()
-{
- m_pBackground->ClearTokens();
-
- if(auto video = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()) ) {
- bool cached = false;
- std::string path = cPictureCache::GetInstance().GetPath(video->ArtUri(), 1920, 1080, cached);
- m_pBackground->AddStringToken("selecteditembackground", path);
- }
-
- m_pBackground->AddIntToken("isdirectory", 1);
- m_pBackground->AddStringToken("currentdirectorybackground", "/path");
}
eOSState cPlexSdOsd::ProcessKey(eKeys Key)
@@ -92,12 +65,12 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key)
break;
case kRed:
// Prev Tab
- SwitchGrid(m_pViewHeader->NextTab());
+ //SwitchGrid(m_pViewHeader->NextTab());
Flush();
break;
case kGreen:
// Next Tab
- SwitchGrid(m_pViewHeader->PrevTab());
+ //SwitchGrid(m_pViewHeader->PrevTab());
Flush();
break;
default:
@@ -105,89 +78,3 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key)
}
return state;
}
-
-void cPlexSdOsd::SwitchGrid(ePlexMenuTab currentTab)
-{
- if(currentTab == ePlexMenuTab::pmtOnDeck) {
- auto service = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetServer("192.168.1.175", 32400), "/hubs/home/onDeck" ) );
- m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(
- new cBrowserGrid( m_pRootView->GetViewGrid(eViewGrids::vgBrowser), service)
- );
- m_pBrowserGrid->m_pRootView = m_pRootView;
-
- } else if(currentTab == ePlexMenuTab::pmtRecentlyAdded) {
- auto service = std::shared_ptr<plexclient::Plexservice>(new plexclient::Plexservice( plexclient::plexgdm::GetInstance().GetServer("192.168.1.175", 32400), "/library/sections" ) );
- m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(
- new cBrowserGrid( m_pRootView->GetViewGrid(eViewGrids::vgBrowser), service)
- );
- m_pBrowserGrid->m_pRootView = m_pRootView;
-
- } else if(currentTab == ePlexMenuTab::pmtLibrary) {
-
- m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(
- new cBrowserGrid( m_pRootView->GetViewGrid(eViewGrids::vgBrowser))
- );
- m_pBrowserGrid->m_pRootView = m_pRootView;
- }
-}
-
-void cPlexSdOsd::DrawFooter()
-{
- //if (!active)
- // return;
-
- string textGreen = tr("Prev. Tab");
- string textYellow = tr("Next Tab");
- string textRed = "";
- string textBlue = "";
-
- if(auto vid = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()) ) {
- if(vid->m_iViewCount > 0) textRed = tr("Unscrobble");
- else textRed = tr("Scrobble");
- textBlue = tr("Info");
- }
-
-
- int colorKeys[4] = { Setup.ColorKey0, Setup.ColorKey1, Setup.ColorKey2, Setup.ColorKey3 };
-
- 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->Display();
-}
diff --git a/plexSdOsd.h b/plexSdOsd.h
index f4f4427..2dbe59f 100644
--- a/plexSdOsd.h
+++ b/plexSdOsd.h
@@ -17,7 +17,6 @@
#include "hlsPlayerControl.h"
#include "browserGrid.h"
-#include "viewHeader.h"
#include "libskindesigner/osdelements.h"
#include "libskindesigner/skindesignerosdbase.h"
@@ -40,9 +39,7 @@ class cPlexSdOsd : public cSkindesignerOsdObject
{
private:
std::shared_ptr<cBrowserGrid> m_pBrowserGrid;
- std::shared_ptr<cViewHeader> m_pViewHeader;
- std::shared_ptr<cViewElement> m_pBackground;
- std::shared_ptr<cViewElement> m_pfooter;
+
cOsdView* m_pRootView;
void Flush();
diff --git a/plexgdm.cpp b/plexgdm.cpp
index d8da646..4878012 100644
--- a/plexgdm.cpp
+++ b/plexgdm.cpp
@@ -1,5 +1,6 @@
#include <vdr/tools.h>
#include "plexgdm.h"
+#include "Config.h"
#include <ctime>
namespace plexclient
@@ -57,7 +58,11 @@ std::string plexgdm::getClientDetails()
void plexgdm::Action()
{
-
+ if(Config::GetInstance().UseConfiguredServer) {
+ // Adds a Server to vector
+ GetServer(Config::GetInstance().s_serverHost, Config::GetInstance().ServerPort);
+ }
+
char buffer[1024];
m_registrationIsRunning = true;
m_discoveryIsRunning = true;
@@ -186,4 +191,10 @@ PlexServer* plexgdm::GetServer(std::string ip, int port)
return &m_vServers[m_vServers.size()-1];
}
+PlexServer* plexgdm::GetFirstServer()
+{
+ if(m_vServers.size() > 0) return &m_vServers[0];
+ else return NULL;
+}
+
} // namespace
diff --git a/plexgdm.h b/plexgdm.h
index 72d3059..87ce82e 100644
--- a/plexgdm.h
+++ b/plexgdm.h
@@ -34,6 +34,7 @@ public:
std::string getClientDetails();
PlexServer* getServerList();
PlexServer* GetServer(std::string ip, int port);
+ PlexServer* GetFirstServer();
void discover();
void checkClientRegistration();
diff --git a/skins/blackhole/xmlfiles/plug-plex-root.xml b/skins/blackhole/xmlfiles/plug-plex-root.xml
index 18a2c97..4f29e14 100644
--- a/skins/blackhole/xmlfiles/plug-plex-root.xml
+++ b/skins/blackhole/xmlfiles/plug-plex-root.xml
@@ -50,6 +50,7 @@
{title} Name of the element
{year}
{thumb} Image/Cover
+ {art} Fanart
{isdummy} Condition
@@ -66,6 +67,8 @@
{ismovie}
{isepisode}
+ {hasbanner}
+ {banner}
-->
<grid name="browser" x="0" y="15%" width="100%" height="85%">
@@ -76,8 +79,9 @@
<drawtext condition="{isserver}" x="1%" y="60%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{serverstartpointname}" />
<drawtext condition="{isdirectory}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Directory" />
<drawtext condition="{ismovie}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Movie" />
- <drawimage condition="{ismovie}" imagetype="image" path="{thumb}" x="5%" y="5%" width="95%" height="95%" />
+ <drawimage condition="{ismovie}" imagetype="image" path="{thumb}" x="10%" y="20%" width="80%" height="80%" />
<drawtext condition="{isepisode}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Episode" />
+ <drawimage condition="{isepisode}" imagetype="image" path="{grandparentthumb}" x="10%" y="20%" width="80%" height="80%" />
</area>
</grid>
diff --git a/viewGridNavigator.cpp b/viewGridNavigator.cpp
index 75192a9..60e57cf 100644
--- a/viewGridNavigator.cpp
+++ b/viewGridNavigator.cpp
@@ -12,7 +12,7 @@ cGridElement::cGridElement()
m_bInit = true;
}
-cViewGridNavigator::cViewGridNavigator(cViewGrid* viewGrid)
+cViewGridNavigator::cViewGridNavigator(cOsdView* rootView, cViewGrid* viewGrid)
{
m_columns = 2;
m_rows = 2;
@@ -20,6 +20,7 @@ cViewGridNavigator::cViewGridNavigator(cViewGrid* viewGrid)
m_setIterator = true;
m_pGrid = std::shared_ptr<cViewGrid>(viewGrid);
+ m_pRootView = rootView;
}
@@ -38,9 +39,7 @@ void cViewGridNavigator::ReDraw(cGridElement* element)
double height = 1.0 / m_rows;
m_pGrid->SetGrid(element->GridElementId(), x, y, width, height);
Flush();
- m_pRootView->Display();
}
-//
}
void cViewGridNavigator::FilterElements(int scrollOffset)
diff --git a/viewGridNavigator.h b/viewGridNavigator.h
index a0fb920..906257b 100644
--- a/viewGridNavigator.h
+++ b/viewGridNavigator.h
@@ -38,6 +38,7 @@ protected:
int m_columns;
std::shared_ptr<cViewGrid> m_pGrid;
+ cOsdView* m_pRootView;
bool m_newDimensions;
bool m_setIterator;
@@ -51,21 +52,18 @@ protected:
void SetGridElementData(cGridElement *obj);
public:
- cViewGridNavigator(cViewGrid* viewGrid);
+ cViewGridNavigator(cOsdView* rootView, cViewGrid* viewGrid);
void SetGridDimensions(int rows, int columns);
- void Flush() { m_pGrid->Display(); };
- void Clear() { m_pGrid->Clear(); };
- void DrawGrid() { m_pGrid->Display(); }
+ virtual void Flush() { m_pGrid->Display(); };
+ virtual void Clear() { m_pGrid->Clear(); };
virtual void NavigateLeft();
virtual void NavigateRight();
virtual void NavigateUp();
virtual void NavigateDown();
virtual eOSState NavigateSelect() = 0;
virtual eOSState NavigateBack() = 0;
+ virtual void ReDraw(cGridElement* element);
cGridElement* SelectedObject() { return *m_activeElementIter; }
- void ReDraw(cGridElement* element);
-
- cOsdView* m_pRootView;
};
#endif // CVIEWGRIDNAVIGATOR_H