summaryrefslogtreecommitdiff
path: root/PlexServer.h
blob: e530aa9c7a5dbb20101ae5256d0e2652dc13a48e (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef PLEXSERVER_H
#define PLEXSERVER_H

#include <stdlib.h>
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <memory>

#include <Poco/String.h>
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPSClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/MessageHeader.h>
#include <Poco/URI.h>

namespace plexclient
{

class PlexServer
{
	friend class plexgdm;

	public:
	PlexServer(std::string uri, std::string name, std::string uuid, std::string accessToken, bool owned, bool local);
	~PlexServer();
	
	int GetMaster() const {
		return m_nMaster;
	}

	int IsOwned() const {
		return m_nOwned;
	}
	const std::string& GetContentType() const {
		return m_sContentType;
	}
	const std::string& GetDiscovery() const {
		return m_sDiscovery;
	}
	const std::string& GetRole() const {
		return m_sRole;
	}
	const std::string& GetServerName() const {
		return m_sServerName;
	}
	long GetUpdated() const {
		return m_nUpdated;
	}
	const std::string& GetUuid() const {
		return m_sUuid;
	}
	const std::string& GetVersion() const {
		return m_sVersion;
	}
	const std::string& GetAuthToken() const {
		return m_authToken;
	}
	const bool& IsLocal() const {
		return m_bLocal;
	}
	
	std::string GetHost();
	int GetPort();
	
	std::string GetUri();
	
	Poco::Net::HTTPClientSession* GetClientSession();

	void DiscoverSettings();
	bool Offline;

protected:
	PlexServer(std::string data, std::string ip);
	PlexServer(std::string ip, int port);
	PlexServer() {};
	
	void ParseData(std::string data, std::string ip);

private:
	std::string m_sDiscovery;

	int m_nOwned;
	bool m_bLocal;
	int m_nMaster;
	std::string m_sRole;
	std::string m_sContentType;
	std::string m_sUuid;
	std::string m_sServerName;
	std::string m_uri;
	std::string m_authToken;
	long m_nUpdated;
	std::string m_sVersion;
	Poco::Net::HTTPClientSession* m_httpSession;

};

}
#endif // PLEXSERVER_H