summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian <zerov83@gmail.com>2016-06-26 16:04:53 +0200
committerChristian <zerov83@gmail.com>2016-06-26 16:04:53 +0200
commitd00510109018d19f9aaabdac8aa115a513e6ef0c (patch)
treee019e665dafc47fc4dfac7a5b4e77199006ab7b6
parentd13d6f430cc29abf6920bef4ee9d3d3be11d52e6 (diff)
downloadvdr-plugin-plex-d00510109018d19f9aaabdac8aa115a513e6ef0c.tar.gz
vdr-plugin-plex-d00510109018d19f9aaabdac8aa115a513e6ef0c.tar.bz2
Fixes mirror mode.0.4.0
-rw-r--r--PlexHTTPRequestHandler.cpp8
-rw-r--r--SubscriptionManager.h3
-rw-r--r--browserGrid.cpp7
-rw-r--r--browserGrid.h2
-rw-r--r--plex.cpp7
-rw-r--r--plexSdOsd.cpp27
-rw-r--r--plexSdOsd.h7
7 files changed, 44 insertions, 17 deletions
diff --git a/PlexHTTPRequestHandler.cpp b/PlexHTTPRequestHandler.cpp
index 4acc0a3..28fac43 100644
--- a/PlexHTTPRequestHandler.cpp
+++ b/PlexHTTPRequestHandler.cpp
@@ -238,7 +238,7 @@ namespace plexclient {
}
- ActionManager::GetInstance().AddAction(Action{Cont->m_vVideos[0], ActionType::Play});
+ ActionManager::GetInstance().AddAction(Action{Cont, ActionType::Play});
}
} else if (request.getURI().find("/playback/play") != std::string::npos) {
cRemote::Put(kPlay);
@@ -314,8 +314,10 @@ void plexclient::MirrorRequestHandler::handleRequest(Poco::Net::HTTPServerReques
std::string fullUrl = protocol + "://" + address + ":" + port + key; // Metainfo
auto Cont = Plexservice::GetMediaContainer(fullUrl);
- ActionManager::GetInstance().AddAction(Action {Cont->m_vVideos[0], ActionType::Display});
- AddHeaders(response, request);
+ if(Cont) {
+ ActionManager::GetInstance().AddAction(Action {Cont, ActionType::Display});
+ AddHeaders(response, request);
+ }
response.send() << GetOKMsg();
}
}
diff --git a/SubscriptionManager.h b/SubscriptionManager.h
index 9efaa5b..31fb213 100644
--- a/SubscriptionManager.h
+++ b/SubscriptionManager.h
@@ -96,7 +96,8 @@ namespace plexclient {
enum class ActionType { Play, Display };
struct Action {
- cVideo video;
+ //cVideo video;
+ std::shared_ptr<MediaContainer> container;
ActionType type;
};
diff --git a/browserGrid.cpp b/browserGrid.cpp
index d4cde96..5fdd01e 100644
--- a/browserGrid.cpp
+++ b/browserGrid.cpp
@@ -101,6 +101,13 @@ void cBrowserGrid::SwitchView(ViewMode mode) {
FilterElements(0);
}
+void cBrowserGrid::ShowDirectory(std::shared_ptr<plexclient::MediaContainer> container){
+ m_pContainer = container;
+ m_bServersAreRoot = false;
+ m_vServerElements.clear();
+ ProcessData();
+}
+
void cBrowserGrid::NextViewMode() {
ViewMode mode = Config::GetInstance().DefaultViewMode;
if (mode == ViewMode::Cover) {
diff --git a/browserGrid.h b/browserGrid.h
index ee62170..dc10291 100644
--- a/browserGrid.h
+++ b/browserGrid.h
@@ -88,6 +88,8 @@ public:
void NextViewMode();
+ void ShowDirectory(std::shared_ptr<plexclient::MediaContainer> container);
+
virtual eOSState NavigateSelect();
virtual eOSState NavigateBack();
diff --git a/plex.cpp b/plex.cpp
index 408f01f..5c6923f 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -206,7 +206,7 @@ cOsdObject *cMyPlugin::MainMenuAction(void) {
if (bSkindesigner && m_pTestOsd->SdSupport()) {
if (m_bShowInfo) {
m_bShowInfo = false;
- return new cPlexSdOsd(m_pPlugStruct, &action.video);
+ return new cPlexSdOsd(m_pPlugStruct, action.container);
}
return new cPlexSdOsd(m_pPlugStruct);
}
@@ -227,9 +227,10 @@ void cMyPlugin::MainThreadHook(void) {
if (ActionManager::GetInstance().IsAction()) {
action = ActionManager::GetInstance().GetAction();
if(action.type == ActionType::Play) {
- PlayFile(action.video);
+ if(action.container->m_vVideos.size() > 0)
+ PlayFile(action.container->m_vVideos[0]);
}
- else if (action.type == ActionType::Display) {
+ else if (bSkindesigner && action.type == ActionType::Display) {
m_bShowInfo = true;
cRemote::CallPlugin("plex");
}
diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp
index e271eef..b56d1dc 100644
--- a/plexSdOsd.cpp
+++ b/plexSdOsd.cpp
@@ -7,8 +7,8 @@
cMutex cPlexSdOsd::RedrawMutex;
-cPlexSdOsd::cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct, plexclient::cVideo* detailVideo) : cPlexSdOsd(plugStruct) {
- m_pDetailVideo = detailVideo;
+cPlexSdOsd::cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct, std::shared_ptr<plexclient::MediaContainer> detailContainer) : cPlexSdOsd(plugStruct) {
+ m_pDetailContainer = detailContainer;
}
cPlexSdOsd::cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct) : cSkindesignerOsdObject(plugStruct) {
@@ -52,8 +52,8 @@ void cPlexSdOsd::Show(void) {
m_pBrowserGrid = std::shared_ptr<cBrowserGrid>(new cBrowserGrid(m_pRootView));
m_pMessage = std::shared_ptr<skindesignerapi::cViewElement>(
m_pRootView->GetViewElement((int) eViewElementsRoot::message));
- if(m_pDetailVideo) {
- ShowDetails(m_pDetailVideo);
+ if(m_pDetailContainer) {
+ ShowDetails(m_pDetailContainer);
}
Flush();
}
@@ -228,9 +228,7 @@ eOSState cPlexSdOsd::ProcessKeyBrowserView(eKeys Key) {
return state;
}
-void cPlexSdOsd::ShowDetails(plexclient::cVideo *vid) {
- if (m_detailsActive) return;
-
+void cPlexSdOsd::ShowDetails(plexclient::cVideo* vid) {
m_pBrowserGrid->Deactivate(true);
m_pDetailsView = std::shared_ptr<skindesignerapi::cOsdView>(GetOsdView((int) eViews::detailView));
m_pDetailGrid = std::make_shared<cDetailView>(m_pDetailsView, vid);
@@ -241,6 +239,20 @@ void cPlexSdOsd::ShowDetails(plexclient::cVideo *vid) {
m_detailsActive = true;
}
+void cPlexSdOsd::ShowDetails(std::shared_ptr<plexclient::MediaContainer> container) {
+ if (m_detailsActive) return;
+
+ if (container->m_vDirectories.size() > 0 || container->m_vVideos.size() > 1) {
+ // show browser
+ m_pBrowserGrid->ShowDirectory(container);
+ m_pBrowserGrid->Activate();
+ m_pBrowserGrid->Flush();
+ }
+ else if (container->m_vVideos.size() > 0) {
+ ShowDetails(&container->m_vVideos[0]);
+ }
+}
+
void cPlexSdOsd::DrawMessage(std::string message) {
m_pMessage->ClearTokens();
m_pMessage->AddStringToken((int) eTokenMessageStr::message, message.c_str());
@@ -413,3 +425,4 @@ void cPlexSdOsd::DefineDetailsTokens(eViewElementsDetail ve, skindesignerapi::cT
break;
}
}
+
diff --git a/plexSdOsd.h b/plexSdOsd.h
index da8482d..d3eca01 100644
--- a/plexSdOsd.h
+++ b/plexSdOsd.h
@@ -30,7 +30,7 @@ private:
std::shared_ptr<skindesignerapi::cViewElement> m_pMessage = nullptr;
bool m_messageDisplayed = false;
bool m_detailsActive = false;
- plexclient::cVideo* m_pDetailVideo = nullptr;
+ std::shared_ptr<plexclient::MediaContainer> m_pDetailContainer = nullptr;
std::shared_ptr<skindesignerapi::cOsdView> m_pRootView = nullptr;
std::shared_ptr<skindesignerapi::cOsdView> m_pDetailsView = nullptr;
@@ -42,13 +42,14 @@ private:
public:
cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct);
- cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct, plexclient::cVideo* detailVideo);
+ cPlexSdOsd(skindesignerapi::cPluginStructure *plugStruct, std::shared_ptr<plexclient::MediaContainer> detailContainer);
~cPlexSdOsd();
virtual void Show(void);
- void ShowDetails(plexclient::cVideo *vid);
+ void ShowDetails(std::shared_ptr<plexclient::MediaContainer> container);
+ void ShowDetails(plexclient::cVideo* vid);
virtual eOSState ProcessKey(eKeys Key);