blob: 5675009bd9f031f87e66165fe8baa4b4bd163074 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include <vdr/tools.h>
#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;
}
}
}
}
PlexServer::PlexServer(std::string ip, int port)
{
m_sIpAddress = ip;
m_nPort = port;
}
std::string PlexServer::GetUri()
{
return std::string("http://") + m_sIpAddress + ":" + std::string(itoa(m_nPort));
}
PlexServer::~PlexServer()
{
}
}
|