summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-02-07 16:05:10 +0100
committerchriszero <zerov83@gmail.com>2015-02-07 16:05:10 +0100
commit2cabbc7e52769a897f72521bea1feaacf2981bf3 (patch)
tree52cd0debb08304ef5df0444b1dcbf47d835f9c2d
parent312c13f4f6b299a976787542869f96b1e66549cf (diff)
downloadvdr-plugin-plex-2cabbc7e52769a897f72521bea1feaacf2981bf3.tar.gz
vdr-plugin-plex-2cabbc7e52769a897f72521bea1feaacf2981bf3.tar.bz2
Fixes crash when replaying a VDR recording
-rw-r--r--SubscriptionManager.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/SubscriptionManager.cpp b/SubscriptionManager.cpp
index 165018d..327d54f 100644
--- a/SubscriptionManager.cpp
+++ b/SubscriptionManager.cpp
@@ -10,6 +10,7 @@
#include <Poco/Net/MessageHeader.h>
#include "Plexservice.h"
+#include "plexgdm.h"
namespace plexclient
{
@@ -45,8 +46,20 @@ void SubscriptionManager::NotifyServer()
total = total / m_pStatus->pControl->FramesPerSecond() * 1000;
m_pStatus->pControl->GetReplayMode(play, forward, speed);
pVid = m_pStatus->pVideo;
+ } else {
+ return;
}
- else {
+
+ std::string server;
+ int port;
+ if(pVid) {
+ server = pVid->m_pServer->GetIpAdress();
+ port = pVid->m_pServer->GetPort();
+ } else if ( plexgdm::GetInstance().GetPlexservers().size() > 0) {
+ server = plexgdm::GetInstance().GetPlexservers().at(0).GetIpAdress();
+ port = plexgdm::GetInstance().GetPlexservers().at(0).GetPort();
+ } else {
+ // no plexservers in network
return;
}
@@ -75,16 +88,15 @@ void SubscriptionManager::NotifyServer()
Request.add("X-Plex-Provides", "player");
Request.add("X-Plex-Version", "0.0.1a");
- Poco::Net::HTTPClientSession session(pVid->m_pServer->GetIpAdress(), pVid->m_pServer->GetPort());
-
+ Poco::Net::HTTPClientSession session(server, port);
+
session.sendRequest(Request);
Poco::Net::HTTPResponse response;
session.receiveResponse(response);
-
+
if(m_pStatus->PlayerStopped) {
m_bStoppedSent = true;
- }
- else {
+ } else {
m_bStoppedSent = false;
}
} catch (Poco::Exception& e) {
@@ -271,7 +283,7 @@ void cSubscriberStatus::Replaying(const cControl* DvbPlayerControl, const char*
} else {
pVideo = NULL;
}
-
+
SubscriptionManager::GetInstance().Notify();
}