summaryrefslogtreecommitdiff
path: root/PVideo.cpp
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-04-04 15:10:52 +0200
committerchriszero <zerov83@gmail.com>2015-04-04 15:10:52 +0200
commit21ee9e67ff7029c099c9fd772d3dc3e23c955199 (patch)
tree254ecef54be3682aea55ff747f3d2912e5732faf /PVideo.cpp
parentb3a59b06a977129bd773ff46f4fd66e0057fb9cd (diff)
downloadvdr-plugin-plex-21ee9e67ff7029c099c9fd772d3dc3e23c955199.tar.gz
vdr-plugin-plex-21ee9e67ff7029c099c9fd772d3dc3e23c955199.tar.bz2
more skindesigner support
Diffstat (limited to 'PVideo.cpp')
-rw-r--r--PVideo.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/PVideo.cpp b/PVideo.cpp
index f17a9ce..ca8684b 100644
--- a/PVideo.cpp
+++ b/PVideo.cpp
@@ -2,18 +2,20 @@
#include <Poco/Format.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
+#include <functional>
#include <vdr/tools.h>
#include "PlexHelper.h"
+#include "pictureCache.h"
namespace plexclient
{
-Video::Video(Poco::XML::Node* pNode, PlexServer Server, MediaContainer* parent)
+Video::Video(Poco::XML::Node* pNode, PlexServer* Server, MediaContainer* parent)
{
m_iMyPlayOffset = 0;
m_lViewoffset = 0;
- m_Server = Server;
+ m_pServer = Server;
Parse(pNode);
if (m_iParentIndex < 0) {
@@ -24,7 +26,7 @@ Video::Video(Poco::XML::Node* pNode, PlexServer Server, MediaContainer* parent)
bool Video::UpdateFromServer()
{
try {
- Poco::URI fileuri(Poco::format("%s/library/metadata/%d", m_Server.GetUri(), m_iRatingKey));
+ Poco::URI fileuri(Poco::format("%s/library/metadata/%d", m_pServer->GetUri(), m_iRatingKey));
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, fileuri.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
PlexHelper::AddHttpHeader(request);
@@ -138,7 +140,7 @@ std::string Video::GetTitle()
bool Video::SetStream(Stream* stream)
{
try {
- Poco::Net::HTTPClientSession session(m_Server.GetIpAdress(), m_Server.GetPort());
+ Poco::Net::HTTPClientSession session(m_pServer->GetIpAdress(), m_pServer->GetPort());
std::string uri = Poco::format("/library/parts/%d?%s", m_Media.m_iPartId, stream->GetSetStreamQuery());
Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_PUT, uri);
@@ -161,7 +163,7 @@ bool Video::SetStream(Stream* stream)
bool Video::SetUnwatched()
{
try {
- Poco::Net::HTTPClientSession session(m_Server.GetIpAdress(), m_Server.GetPort());
+ Poco::Net::HTTPClientSession session(m_pServer->GetIpAdress(), m_pServer->GetPort());
std::string uri = Poco::format("/:/unscrobble?key=%d&identifier=com.plexapp.plugins.library", m_iRatingKey);
Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_GET, uri);
@@ -184,7 +186,7 @@ bool Video::SetUnwatched()
bool Video::SetWatched()
{
try {
- Poco::Net::HTTPClientSession session(m_Server.GetIpAdress(), m_Server.GetPort());
+ Poco::Net::HTTPClientSession session(m_pServer->GetIpAdress(), m_pServer->GetPort());
std::string uri = Poco::format("/:/scrobble?key=%d&identifier=com.plexapp.plugins.library", m_iRatingKey);
Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_GET, uri);
@@ -204,11 +206,26 @@ bool Video::SetWatched()
}
}
-void Video::AddTokens(std::shared_ptr<cViewGrid>grid)
+void Video::AddTokens(std::shared_ptr<cOsdElement> grid, bool clear, std::function<void(cGridElement*)> OnCached)
{
- grid->ClearTokens();
+ if(clear) grid->ClearTokens();
grid->AddStringToken("title", m_sTitle);
+ grid->AddIntToken("ismovie", 1);
+ bool cached = false;
+ cPictureCache::GetInstance().GetPath(ArtUri(), 1920, 1080, cached);
+ std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), 1280, 720, cached, OnCached, this);
+ if (cached) grid->AddStringToken("thumb", thumb);
}
+std::string Video::ArtUri()
+{
+ return m_pServer->GetUri() + m_sArt;
+}
+
+std::string Video::ThumbUri()
+{
+ return m_pServer->GetUri() + m_sThumb;
+}
} // Namespace
+