summaryrefslogtreecommitdiff
path: root/plex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plex.cpp')
-rw-r--r--plex.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/plex.cpp b/plex.cpp
index 801f497..aa6e022 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -7,6 +7,11 @@
#include "services.h"
#include <libskindesignerapi/skindesignerapi.h>
+#include <Poco/Net/SSLManager.h>
+#include <Poco/SharedPtr.h>
+#include <Poco/Net/Context.h>
+#include <Poco/Net/AcceptCertificateHandler.h>
+#include <Poco/Net/ConsoleCertificateHandler.h>
//////////////////////////////////////////////////////////////////////////////
// cPlugin
@@ -98,6 +103,24 @@ bool cMyPlugin::Start(void)
*/
bool cMyPlugin::Initialize(void)
{
+ // Initialize SSL
+ {
+ using namespace Poco;
+ using namespace Poco::Net;
+ using Poco::Net::SSLManager;
+ using Poco::Net::Context;
+ using Poco::Net::AcceptCertificateHandler;
+ using Poco::Net::PrivateKeyPassphraseHandler;
+ using Poco::Net::InvalidCertificateHandler;
+ using Poco::Net::ConsoleCertificateHandler;
+
+ //SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new PrivateKeyPassphraseHandler;
+ SharedPtr<InvalidCertificateHandler> pInvalidCertHandler = new AcceptCertificateHandler(false);
+ Context::Ptr pContext = new Poco::Net::Context(
+ Context::CLIENT_USE, "", "", "", Context::VERIFY_NONE, // VERIFY_NONE...?!
+ 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
+ SSLManager::instance().initializeClient(NULL, pInvalidCertHandler, pContext);
+ }
// First Startup? Save UUID
SetupStore("UUID", Config::GetInstance().GetUUID().c_str());
@@ -105,7 +128,7 @@ bool cMyPlugin::Initialize(void)
plexclient::plexgdm::GetInstance().Start();
plexclient::ControlServer::GetInstance().Start();
cPictureCache::GetInstance().Start();
-
+
return true;
}
@@ -188,8 +211,14 @@ void cMyPlugin::PlayFile(plexclient::Video Vid)
Mpv_PlayFile req;
Mpv_SetTitle reqTitle;
- char* file = (char*)(Vid.m_pServer->GetUri() + Vid.m_Media.m_sPartKey).c_str();
-
+ char* file;
+ if(Config::GetInstance().UsePlexAccount && Vid.m_pServer->IsLocal() == false) {
+ file = (char*)plexclient::Plexservice::GetUniversalTranscodeUrl(&Vid, Vid.m_iMyPlayOffset, NULL, true).c_str();
+ }
+ else {
+ file = (char*)(Vid.m_pServer->GetUri() + Vid.m_Media.m_sPartKey).c_str();
+ }
+
req.Filename = file;
mpvPlugin->Service(MPV_PLAY_FILE, &req);