summaryrefslogtreecommitdiff
path: root/PlexHTTPRequestHandler.cpp
diff options
context:
space:
mode:
authorChristian <zerov83@gmail.com>2016-04-11 21:53:22 +0200
committerChristian <zerov83@gmail.com>2016-04-11 21:53:22 +0200
commit8d0ed3dc01165fa8b84794276225175ec2094dd4 (patch)
tree90a31dc9fefa1f35270d131e76e9f4f6b173a7a5 /PlexHTTPRequestHandler.cpp
parent82d13a0734c8a11347d50fcc5ad341c8eb1b7a43 (diff)
downloadvdr-plugin-plex-8d0ed3dc01165fa8b84794276225175ec2094dd4.tar.gz
vdr-plugin-plex-8d0ed3dc01165fa8b84794276225175ec2094dd4.tar.bz2
Added protocol capability "mirror"
Displays information about the currently via app viewed video on the VDR. Also fixes "OSD is already open bug"
Diffstat (limited to 'PlexHTTPRequestHandler.cpp')
-rw-r--r--PlexHTTPRequestHandler.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/PlexHTTPRequestHandler.cpp b/PlexHTTPRequestHandler.cpp
index a157087..4acc0a3 100644
--- a/PlexHTTPRequestHandler.cpp
+++ b/PlexHTTPRequestHandler.cpp
@@ -142,7 +142,7 @@ namespace plexclient {
"<Player title=\"" << Config::GetInstance().GetHostname() << "\""
" protocol=\"plex\""
" protocolVersion=\"1\""
- " protocolCapabilities=\"navigation,playback,timeline\""
+ " protocolCapabilities=\"navigation,playback,timeline,mirror\""
" machineIdentifier=\"" << Config::GetInstance().GetUUID() << "\""
" product=\"" << DESCRIPTION << "\""
" platform=\"Linux\""
@@ -238,7 +238,7 @@ namespace plexclient {
}
- ActionManager::GetInstance().AddAction(Cont->m_vVideos[0]);
+ ActionManager::GetInstance().AddAction(Action{Cont->m_vVideos[0], ActionType::Play});
}
} else if (request.getURI().find("/playback/play") != std::string::npos) {
cRemote::Put(kPlay);
@@ -290,3 +290,33 @@ namespace plexclient {
}
} // namespace
+
+void plexclient::MirrorRequestHandler::handleRequest(Poco::Net::HTTPServerRequest &request,
+ Poco::Net::HTTPServerResponse &response) {
+ ///player/mirror/details?type=video&key=%2Flibrary%2Fmetadata%2F113855&machineIdentifier=fbad3115c2c2d82c53b0205e5aa3c4e639ebaa94&protocol=http&address=192.168.1.175&port=32400&token=transient-5557be74-dcad-4c28-badd-aa01b6224862&commandID=2
+ UpdateCommandId(request);
+
+ Poco::URI uri(request.getURI());
+ std::map<std::string, std::string> query = ParseQuery(uri.getQuery());
+
+ if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_OPTIONS) {
+ AddHeaders(response, request);
+ response.setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK);
+ response.send() << " ";
+ return;
+ }
+
+ if (request.getURI().find("/details") != std::string::npos) {
+ std::string protocol = query["protocol"];
+ std::string address = query["address"];
+ std::string port = query["port"];
+ std::string key = query["key"];
+
+ std::string fullUrl = protocol + "://" + address + ":" + port + key; // Metainfo
+ auto Cont = Plexservice::GetMediaContainer(fullUrl);
+ ActionManager::GetInstance().AddAction(Action {Cont->m_vVideos[0], ActionType::Display});
+ AddHeaders(response, request);
+ response.send() << GetOKMsg();
+ }
+}
+