summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-02-17 19:33:13 +0100
committerchriszero <zerov83@gmail.com>2015-02-17 19:33:13 +0100
commit216db1e9eb1800df1969ba3fd6755f898a0b2526 (patch)
tree191d5b4f0c768ba966066a8900288e51ce7c90d6
parent4a86011372c06315b2796f2f4e82c7801027453e (diff)
downloadvdr-plugin-plex-216db1e9eb1800df1969ba3fd6755f898a0b2526.tar.gz
vdr-plugin-plex-216db1e9eb1800df1969ba3fd6755f898a0b2526.tar.bz2
Authentication
-rw-r--r--Plexservice.cpp12
-rw-r--r--Plexservice.h1
-rw-r--r--plex.cpp14
3 files changed, 14 insertions, 13 deletions
diff --git a/Plexservice.cpp b/Plexservice.cpp
index 76de898..a61caec 100644
--- a/Plexservice.cpp
+++ b/Plexservice.cpp
@@ -39,10 +39,9 @@ std::string Plexservice::GetMyPlexToken()
{
static bool done;
static std::string myToken;
-
+
//todo: cache token in file or db
- if(!done || myToken.empty()) {
- std::cout << "Get Token" << std::endl;
+ if(!done) {
std::stringstream ss;
Poco::Base64Encoder b64(ss);
@@ -77,6 +76,7 @@ std::string Plexservice::GetMyPlexToken()
plexSession.detachSocket();
} catch (Poco::Exception &exc) {
esyslog("[plex]Exception in %s s%", __func__, exc.displayText().c_str() );
+ done = true;
}
}
@@ -120,7 +120,7 @@ std::shared_ptr<MediaContainer> Plexservice::GetSection(std::string section, boo
if(section[0]=='/') { // Full URI?
uri = section;
} else {
- uri = Poco::format("%s/%s", m_vUriStack.top(), section);// m_vUriStack.top() + "/" + section;
+ uri = Poco::format("%s/%s", m_vUriStack.top(), section);
}
pRequest = CreateRequest(uri);
@@ -132,10 +132,10 @@ std::shared_ptr<MediaContainer> Plexservice::GetSection(std::string section, boo
Poco::Net::HTTPResponse response;
std::istream &rs = m_pPlexSession->receiveResponse(response);
- dsyslog("[plex] URI: %s[s%]", m_pPlexSession->getHost().c_str(), pRequest->getURI().c_str());
+ dsyslog("[plex] URI: http://%s:32400%s", m_pPlexSession->getHost().c_str(), pRequest->getURI().c_str());
std::shared_ptr<MediaContainer> pAllsections(new MediaContainer(&rs, *pServer));
- //Poco::StreamCopier::copyStream(rs, std::cout);
+
delete pRequest;
return pAllsections;
diff --git a/Plexservice.h b/Plexservice.h
index e96bf16..e2cab4b 100644
--- a/Plexservice.h
+++ b/Plexservice.h
@@ -65,6 +65,7 @@ private:
Poco::Net::HTTPClientSession* GetHttpSession(bool createNew = false);
Poco::Net::HTTPRequest* CreateRequest(std::string path);
+
};
}
diff --git a/plex.cpp b/plex.cpp
index 710c70f..3707d88 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -67,9 +67,9 @@ eOSState cPlexBrowser::ProcessKey(eKeys key)
// call standard function
state = cOsdMenu::ProcessKey(key);
- if (state || key != kNone) {
- dsyslog("[plex]%s: state=%d key=%d\n", __FUNCTION__, state, key);
- }
+ //if (state || key != kNone) {
+ // dsyslog("[plex]%s: state=%d key=%d\n", __FUNCTION__, state, key);
+ //}
switch (state) {
case osUnknown:
@@ -118,7 +118,7 @@ eOSState cPlexBrowser::ProcessSelected()
if(item->IsDir()) {
plexclient::Directory* pDir = item->GetAttachedDirectory();
pCont = pService->GetSection(pDir->m_sKey);
- //SetTitle(pDir->m_sTitle.c_str());
+ //SetTitle(pDir->m_sTitle);
CreateMenu();
return osContinue;
}
@@ -214,9 +214,9 @@ eOSState cPlayMenu::ProcessKey(eKeys key)
{
eOSState state;
- if (key != kNone) {
- dsyslog("[plex]%s: key=%d\n", __FUNCTION__, key);
- }
+ //if (key != kNone) {
+ // dsyslog("[plex]%s: key=%d\n", __FUNCTION__, key);
+ //}
// call standard function
state = cOsdMenu::ProcessKey(key);