diff options
author | chriszero <zerov83@gmail.com> | 2015-04-05 22:58:58 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-04-05 22:58:58 +0200 |
commit | 13605a7c30e5e35f33ba824c92d2e7cf706a0fa9 (patch) | |
tree | 5da678c35791595a8f6e6508bb028b018cb2dd90 | |
parent | f3d792a866ba602458d5d6c521bafa66e56a5528 (diff) | |
download | vdr-plugin-plex-13605a7c30e5e35f33ba824c92d2e7cf706a0fa9.tar.gz vdr-plugin-plex-13605a7c30e5e35f33ba824c92d2e7cf706a0fa9.tar.bz2 |
detect skindesigner support
-rw-r--r-- | PVideo.cpp | 12 | ||||
-rw-r--r-- | plex.cpp | 19 | ||||
-rw-r--r-- | plex.h | 4 | ||||
-rw-r--r-- | plexSdOsd.cpp | 16 | ||||
-rw-r--r-- | plexSdOsd.h | 7 | ||||
-rw-r--r-- | skins/blackhole/xmlfiles/plug-plex-detail.xml | 16 |
6 files changed, 59 insertions, 15 deletions
@@ -215,8 +215,9 @@ void Video::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::functi grid->AddStringToken("title", m_sTitle); bool cached = false; - cPictureCache::GetInstance().GetPath(ArtUri(), 1920, 1080, cached); - std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), 1280, 720, cached, OnCached, this); + //cPictureCache::GetInstance().GetPath(ArtUri(), Config::GetInstance().ArtWidth(), Config::GetInstance().ArtHeight(), cached); + 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); if(m_tType == MediaType::MOVIE) { @@ -226,13 +227,14 @@ void Video::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::functi 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); + std::string grandparentThumb = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_sGrandparentThumb, Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this); + grid->AddIntToken("hasgrandparentthumb", cached); 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); + 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", true); grid->AddStringToken("banner", banner); @@ -243,11 +245,13 @@ void Video::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::functi std::string Video::ArtUri() { + if(m_sArt.find("http://") != std::string::npos) return m_sArt; return m_pServer->GetUri() + m_sArt; } std::string Video::ThumbUri() { + if(m_sThumb.find("http://") != std::string::npos) return m_sThumb; return m_pServer->GetUri() + m_sThumb; } @@ -21,6 +21,7 @@ volatile bool cMyPlugin::CalledFromCode = false; */ cMyPlugin::cMyPlugin(void) { + m_pSdCheck = NULL; } /** @@ -30,6 +31,7 @@ cMyPlugin::~cMyPlugin(void) { plexclient::plexgdm::GetInstance().stopRegistration(); plexclient::ControlServer::GetInstance().Stop(); + delete m_pSdCheck; } /** @@ -55,8 +57,6 @@ const char *cMyPlugin::Description(void) bool cMyPlugin::Start(void) { - std::string cacheDir = cPlugin::CacheDirectory(PLUGIN_NAME_I18N); - RegisterPlugin reg; reg.name = "plex"; @@ -66,11 +66,15 @@ 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"); + reg.SetViewElement(viDetailView, vedBackground, "background"); + reg.SetViewElement(viDetailView, vedHeader, "header"); + reg.SetViewElement(viDetailView, vedFooter, "footer"); static cPlugin *pSkinDesigner = cPluginManager::GetPlugin("skindesigner"); if (pSkinDesigner) { pSkinDesigner->Service("RegisterPlugin", ®); + m_pSdCheck = new cPlexSdOsd(); } else { esyslog("[plex]: skindesigner not available"); } @@ -107,13 +111,8 @@ const char *cMyPlugin::MainMenuEntry(void) cOsdObject *cMyPlugin::MainMenuAction(void) { //dsyslog("[plex]%s:\n", __FUNCTION__); - /*bool skinDesignerAvailable = InitSkindesignerInterface("plex"); - if (skinDesignerAvailable) { - //cOsdView *rootView = GetOsdView(viRootView); - return new cPlexSdOsd(); - } - return cPlexMenu::ProcessMenu();*/ - return new cPlexSdOsd(); + if(m_pSdCheck && m_pSdCheck->SdSupport()) return new cPlexSdOsd(); + else return cPlexMenu::ProcessMenu(); } /** @@ -16,6 +16,7 @@ #include "plexgdm.h" #include "cPlexOsdItem.h" #include "hlsPlayerControl.h" +#include "plexSdOsd.h" #include <iostream> #include <string> @@ -38,6 +39,9 @@ static const char *const MAINMENUENTRY = "Plex for VDR"; class cMyPlugin:public cPlugin { +private: + cPlexSdOsd* m_pSdCheck; + public: cMyPlugin(void); virtual ~ cMyPlugin(void); diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp index db50168..6e3ae17 100644 --- a/plexSdOsd.cpp +++ b/plexSdOsd.cpp @@ -14,6 +14,20 @@ cPlexSdOsd::~cPlexSdOsd() cPictureCache::GetInstance().RemoveAll(); } +bool cPlexSdOsd::SdSupport() +{ + bool skinDesignerAvailable = InitSkindesignerInterface("plex"); + if (skinDesignerAvailable) { + + cOsdView *rootView = GetOsdView(eViews::viRootView); + if (!rootView) { + esyslog("[plex]: used skindesigner skin does not support plex"); + return false; + } + } + return skinDesignerAvailable; +} + void cPlexSdOsd::Show(void) { bool skinDesignerAvailable = InitSkindesignerInterface("plex"); @@ -26,7 +40,7 @@ void cPlexSdOsd::Show(void) esyslog("[plex]: used skindesigner skin does not support plex"); return; } - + m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(new cBrowserGrid(m_pRootView)); Flush(); } diff --git a/plexSdOsd.h b/plexSdOsd.h index 433522b..2cc5508 100644 --- a/plexSdOsd.h +++ b/plexSdOsd.h @@ -35,6 +35,12 @@ enum eViewGrids { vgBrowser }; +enum eViewElementsDetail { + vedBackground, + vedHeader, + vedFooter +}; + class cPlexSdOsd : public cSkindesignerOsdObject { private: @@ -53,6 +59,7 @@ public: virtual void Show(void); virtual eOSState ProcessKey(eKeys Key); + bool SdSupport(); static cMutex RedrawMutex; }; diff --git a/skins/blackhole/xmlfiles/plug-plex-detail.xml b/skins/blackhole/xmlfiles/plug-plex-detail.xml new file mode 100644 index 0000000..425d18f --- /dev/null +++ b/skins/blackhole/xmlfiles/plug-plex-detail.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE displayplugin SYSTEM "../../../dtd/displayplugin.dtd"> + +<displayplugin x="0" y="0" width="100%" height="100%" fadetime="0" scaletvx="0" scaletvy="0" scaletvwidth="100%" scaletvheight="100%"> + + <viewelement name="background"> + </viewelement> + + <viewelement name="header"> + </viewelement> + + <viewelement name="footer"> + </viewelement> + + +</displayplugin>
\ No newline at end of file |