summaryrefslogtreecommitdiff
path: root/PlexServer.cpp
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2014-11-15 19:43:07 +0100
committerchriszero <zerov83@gmail.com>2014-11-15 19:43:07 +0100
commit23f9f7712bfa33b5a488a447a6fabe6035cc3240 (patch)
tree06bbe8e0bc52496c5ad3c41accc7524aa597e670 /PlexServer.cpp
parenta40adaf76fb1267d38b4c5e6386933ddb2d0d328 (diff)
downloadvdr-plugin-plex-23f9f7712bfa33b5a488a447a6fabe6035cc3240.tar.gz
vdr-plugin-plex-23f9f7712bfa33b5a488a447a6fabe6035cc3240.tar.bz2
initial commit
Diffstat (limited to 'PlexServer.cpp')
-rw-r--r--PlexServer.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/PlexServer.cpp b/PlexServer.cpp
new file mode 100644
index 0000000..94ba0e8
--- /dev/null
+++ b/PlexServer.cpp
@@ -0,0 +1,41 @@
+#include "PlexServer.h"
+
+namespace plexclient
+{
+
+PlexServer::PlexServer(std::string data, std::string ip)
+{
+ m_sIpAddress = ip;
+ std::istringstream f(data);
+ std::string s;
+ while(std::getline(f, s)) {
+ int pos = s.find(':');
+ if(pos > 0) {
+ std::string name = Poco::trim(s.substr(0, pos));
+ std::string val = Poco::trim(s.substr(pos+1));
+ if(name == "Content-Type") {
+ m_sContentType = val;
+ } else if (name == "Resource-Identifier") {
+ m_sUuid = val;
+ } else if (name == "Name") {
+ m_sServerName = val;
+ } else if (name == "Port") {
+ m_nPort = atoi(val.c_str());
+ } else if (name == "Updated-At") {
+ m_nUpdated = atol(val.c_str());
+ } else if (name == "Version") {
+ m_sVersion = val;
+ }
+ }
+ }
+}
+
+std::string PlexServer::GetUri() {
+ return std::string("http://") + m_sIpAddress + ":" + std::to_string(m_nPort);
+}
+
+PlexServer::~PlexServer()
+{
+}
+
+}