summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian <zerov83@gmail.com>2016-03-28 20:41:54 +0200
committerChristian <zerov83@gmail.com>2016-03-28 20:41:54 +0200
commitbd3d480a94558344f0a55707bc59b181fc7ea943 (patch)
treed54aaa531c747df28950e0db542f9d9cb26874e0
parent495f828b507611fafa49997adf7f2bda815cdcb8 (diff)
downloadvdr-plugin-plex-bd3d480a94558344f0a55707bc59b181fc7ea943.tar.gz
vdr-plugin-plex-bd3d480a94558344f0a55707bc59b181fc7ea943.tar.bz2
paralleling cPictureCache.
Multiple server connections now possible
-rw-r--r--PVideo.cpp10
-rw-r--r--PVideo.h1
-rw-r--r--PlexServer.cpp45
-rw-r--r--PlexServer.h6
-rw-r--r--Plexservice.cpp14
-rw-r--r--SubscriptionManager.cpp5
-rw-r--r--browserGrid.cpp2
-rw-r--r--displayReplaySD.cpp35
-rw-r--r--displayReplaySD.h20
-rw-r--r--hlsPlayer.cpp21
-rw-r--r--pictureCache.cpp102
-rw-r--r--pictureCache.h18
-rw-r--r--plex.cpp10
-rw-r--r--plex.h1
-rw-r--r--plexSdOsd.cpp1
-rw-r--r--po/de_DE.po2
-rw-r--r--viewGridNavigator.cpp10
-rw-r--r--viewGridNavigator.h1
18 files changed, 147 insertions, 157 deletions
diff --git a/PVideo.cpp b/PVideo.cpp
index ca4add7..6b502bc 100644
--- a/PVideo.cpp
+++ b/PVideo.cpp
@@ -211,10 +211,11 @@ bool Video::SetUnwatched()
try {
std::string uri = Poco::format("/:/unscrobble?key=%d&identifier=com.plexapp.plugins.library", m_iRatingKey);
- Poco::Net::HTTPResponse resp;
bool ok;
- m_pServer->MakeRequest(resp, ok, uri);
-
+ auto cSession = m_pServer->MakeRequest(ok, uri);
+ Poco::Net::HTTPResponse resp;
+ cSession->receiveResponse(resp);
+
if(resp.getStatus() == 200) {
dsyslog("[plex]: Set Unwatched: %s", uri.c_str());
return true;
@@ -231,9 +232,8 @@ bool Video::SetWatched()
try {
std::string uri = Poco::format("/:/scrobble?key=%d&identifier=com.plexapp.plugins.library", m_iRatingKey);
- Poco::Net::HTTPResponse resp;
bool ok;
- m_pServer->MakeRequest(resp, ok, uri);
+ auto cSession = m_pServer->MakeRequest(ok, uri);
if(ok) {
dsyslog("[plex]: Set Watched: %s", uri.c_str());
diff --git a/PVideo.h b/PVideo.h
index 8330d53..ed5b8dc 100644
--- a/PVideo.h
+++ b/PVideo.h
@@ -104,6 +104,7 @@ public:
#ifdef SKINDESIGNER
// gridElement
virtual void AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool clear = true, std::function<void(cGridElement*)> OnCached = NULL);
+
#endif
};
diff --git a/PlexServer.cpp b/PlexServer.cpp
index 2fec22b..42db999 100644
--- a/PlexServer.cpp
+++ b/PlexServer.cpp
@@ -8,8 +8,6 @@ namespace plexclient
PlexServer::PlexServer(std::string ip, int port)
{
- m_httpSession = NULL;
-
Poco::URI uri;
uri.setHost(ip);
uri.setPort(port);
@@ -20,13 +18,11 @@ PlexServer::PlexServer(std::string ip, int port)
PlexServer::PlexServer(std::string data, std::string ip)
{
- m_httpSession = NULL;
ParseData(data, ip);
}
PlexServer::PlexServer(std::string uri, std::string name, std::string uuid, std::string accessToken, bool owned, bool local)
{
- m_httpSession = NULL;
m_sServerName = name;
m_sUuid = uuid;
m_nOwned = owned;
@@ -38,8 +34,7 @@ PlexServer::PlexServer(std::string uri, std::string name, std::string uuid, std:
PlexServer::~PlexServer()
{
- delete m_httpSession;
- m_httpSession = NULL;
+
}
void PlexServer::ParseData(std::string data, std::string ip)
@@ -92,22 +87,22 @@ int PlexServer::GetPort()
return uri.getPort();
}
-Poco::Net::HTTPClientSession* PlexServer::GetClientSession()
+std::shared_ptr<Poco::Net::HTTPClientSession> PlexServer::GetClientSession()
{
Poco::URI uri(m_uri);
- if(m_httpSession == NULL) {
- if(uri.getScheme().find("https") != std::string::npos) {
- m_httpSession = new Poco::Net::HTTPSClientSession(uri.getHost(), uri.getPort());
- }
- else {
- m_httpSession = new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort());
- }
+ std::shared_ptr<Poco::Net::HTTPClientSession> pHttpSession = nullptr;
+ if(uri.getScheme().find("https") != std::string::npos) {
+ pHttpSession = std::make_shared<Poco::Net::HTTPSClientSession>(uri.getHost(), uri.getPort());
}
- m_httpSession->setTimeout(Poco::Timespan(5, 0)); // set 5 seconds Timeout
- return m_httpSession;
+ else {
+ pHttpSession = std::make_shared<Poco::Net::HTTPClientSession>(uri.getHost(), uri.getPort());
+ }
+
+ //pHttpSession->setTimeout(Poco::Timespan(5, 0)); // set 5 seconds Timeout
+ return pHttpSession;
}
-std::istream& PlexServer::MakeRequest(Poco::Net::HTTPResponse& response, bool& ok, std::string path, const std::map<std::string, std::string>& queryParameters)
+std::shared_ptr<Poco::Net::HTTPClientSession> PlexServer::MakeRequest(bool& ok, std::string path, const std::map<std::string, std::string>& queryParameters)
{
Poco::URI uri(path);
// Create a request with an optional query
@@ -134,26 +129,18 @@ std::istream& PlexServer::MakeRequest(Poco::Net::HTTPResponse& response, bool& o
// Add PlexToken to Header
request.add("X-Plex-Token", GetAuthToken());
}
- bool excep = false;
+ auto cSession = GetClientSession();
+ ok = true;
try {
- GetClientSession()->sendRequest(request);
+ cSession->sendRequest(request);
} catch (Poco::TimeoutException &exc) {
esyslog("[plex] Timeout: %s", path.c_str());
ok = false;
- excep = true;
} catch (Poco::Exception &exc) {
esyslog("[plex] Oops Exception: %s", exc.displayText().c_str());
ok = false;
- excep = true;
}
- if(!excep) {
- std::istream& stream = GetClientSession()->receiveResponse(response);
- ok = response.getStatus() == 200;
- return stream;
- }
- static std::stringstream* ss;
- return *ss;
-
+ return cSession;
}
std::string PlexServer::GetUri()
diff --git a/PlexServer.h b/PlexServer.h
index 0363343..917f035 100644
--- a/PlexServer.h
+++ b/PlexServer.h
@@ -66,14 +66,14 @@ class PlexServer
m_authToken = token;
}
- std::istream& MakeRequest(Poco::Net::HTTPResponse& response, bool& ok, std::string path, const std::map<std::string, std::string>& queryParameters = std::map<std::string, std::string>());
+ std::shared_ptr<Poco::Net::HTTPClientSession> MakeRequest(bool& ok, std::string path, const std::map<std::string, std::string>& queryParameters = std::map<std::string, std::string>());
std::string GetHost();
int GetPort();
std::string GetUri();
- Poco::Net::HTTPClientSession* GetClientSession();
+ std::shared_ptr<Poco::Net::HTTPClientSession> GetClientSession();
void DiscoverSettings();
bool Offline;
@@ -99,8 +99,6 @@ private:
std::string m_authToken;
long m_nUpdated;
std::string m_sVersion;
- Poco::Net::HTTPClientSession* m_httpSession;
-
};
}
diff --git a/Plexservice.cpp b/Plexservice.cpp
index 8e5b082..a0c1f7f 100644
--- a/Plexservice.cpp
+++ b/Plexservice.cpp
@@ -162,10 +162,11 @@ std::shared_ptr<MediaContainer> Plexservice::GetSection(std::string section, boo
dsyslog("[plex] URI: %s%s", pServer->GetUri().c_str(), uri.c_str());
- Poco::Net::HTTPResponse response;
bool ok;
- std::istream &rs = pServer->MakeRequest(response, ok, uri);
- if(ok) {
+ auto cSession = pServer->MakeRequest(ok, uri);
+ Poco::Net::HTTPResponse response;
+ std::istream& rs = cSession->receiveResponse(response);
+ if(ok && response.getStatus() == 200) {
std::shared_ptr<MediaContainer> pAllsections(new MediaContainer(&rs, pServer));
return pAllsections;
}
@@ -230,10 +231,11 @@ std::shared_ptr<MediaContainer> Plexservice::GetMediaContainer(std::string fullU
pServer = plexgdm::GetInstance().GetServer(fileuri.getHost(), fileuri.getPort());
- Poco::Net::HTTPResponse response;
bool ok;
- std::istream &rs = pServer->MakeRequest(response, ok, fileuri.getPathAndQuery());
- if(ok) {
+ auto cSession = pServer->MakeRequest(ok, fileuri.getPathAndQuery());
+ Poco::Net::HTTPResponse response;
+ std::istream &rs = cSession->receiveResponse(response);
+ if(ok && response.getStatus() == 200) {
std::shared_ptr<MediaContainer> pAllsections = std::shared_ptr<MediaContainer>(new MediaContainer(&rs, pServer));
return pAllsections;
}
diff --git a/SubscriptionManager.cpp b/SubscriptionManager.cpp
index d287c2e..dbdea3e 100644
--- a/SubscriptionManager.cpp
+++ b/SubscriptionManager.cpp
@@ -66,9 +66,8 @@ void SubscriptionManager::ReportProgress()
queryMap["time"] = std::to_string(current);
queryMap["state"] = state;
- Poco::Net::HTTPResponse resp;
bool ok;
- m_pStatus->pVideo->m_pServer->MakeRequest(resp, ok, "/:/progress", queryMap);
+ auto cSession = m_pStatus->pVideo->m_pServer->MakeRequest(ok, "/:/progress", queryMap);
} catch (Poco::Exception&) {}
}
@@ -116,7 +115,7 @@ void SubscriptionManager::NotifyServer()
Poco::Net::HTTPResponse response;
bool ok;
- pServer->MakeRequest(response, ok, "/:/timeline", queryMap);
+ auto cSession = pServer->MakeRequest(ok, "/:/timeline", queryMap);
if(m_pStatus->PlayerStopped) {
diff --git a/browserGrid.cpp b/browserGrid.cpp
index 66ec7e5..b132d24 100644
--- a/browserGrid.cpp
+++ b/browserGrid.cpp
@@ -116,8 +116,6 @@ void cBrowserGrid::NextViewMode()
void cBrowserGrid::SwitchGrid(int index)
{
- cPictureCache::GetInstance().RemoveAll();
-
m_pHeader->Clear();
m_pHeader->ClearTokens();
m_pHeader->AddIntToken((int)eTokenGridInt::columns, m_columns);
diff --git a/displayReplaySD.cpp b/displayReplaySD.cpp
index 11c99e8..87ac511 100644
--- a/displayReplaySD.cpp
+++ b/displayReplaySD.cpp
@@ -1,10 +1,43 @@
#include "displayReplaySD.h"
-cDisplayReplaySD::cDisplayReplaySD(plexclient::Video* video)
+cDisplayReplaySD::cDisplayReplaySD(plexclient::Video* video) : cSkindesignerOsdObject(GetPluginStruct())
{
+
}
cDisplayReplaySD::~cDisplayReplaySD()
{
}
+skindesignerapi::cPluginStructure* cDisplayReplaySD::m_pPlugStructReplay = NULL;
+
+skindesignerapi::cPluginStructure* cDisplayReplaySD::GetPluginStruct()
+{
+ if(m_pPlugStructReplay == NULL) {
+ m_pPlugStructReplay = new skindesignerapi::cPluginStructure();
+ m_pPlugStructReplay->name = "plexreplay";
+ m_pPlugStructReplay->libskindesignerAPIVersion = LIBSKINDESIGNERAPIVERSION;
+ m_pPlugStructReplay->RegisterRootView("root.xml");
+ }
+ return m_pPlugStructReplay;
+}
+
+void cDisplayReplaySD::Show(void)
+{
+}
+
+eOSState cDisplayReplaySD::ProcessKey(eKeys Key)
+{
+ return eOSState::osContinue;
+}
+void cDisplayReplaySD::Flush()
+{
+}
+
+void cDisplayReplaySD::SetCurrent(const char* Current)
+{
+}
+
+void cDisplayReplaySD::SetMode(bool Play, bool Forward, int Speed)
+{
+}
diff --git a/displayReplaySD.h b/displayReplaySD.h
index f38be4b..8961921 100644
--- a/displayReplaySD.h
+++ b/displayReplaySD.h
@@ -7,11 +7,29 @@
#include <libskindesignerapi/osdelements.h>
#include <libskindesignerapi/skindesignerosdbase.h>
-class cDisplayReplaySD
+class cDisplayReplaySD : public skindesignerapi::cSkindesignerOsdObject
{
+private:
+ static skindesignerapi::cPluginStructure* m_pPlugStructReplay;
+ static skindesignerapi::cPluginStructure* GetPluginStruct();
+
+ std::shared_ptr<skindesignerapi::cOsdView> m_pRootView;
+ std::shared_ptr<skindesignerapi::cViewElement> m_pProgessbar;
+ std::shared_ptr<skindesignerapi::cViewElement> m_pBackground;
+ std::shared_ptr<skindesignerapi::cViewElement> m_pVideoinfo;
+ std::shared_ptr<skindesignerapi::cViewElement> m_pTranscodeinfo;
+
public:
cDisplayReplaySD(plexclient::Video* video);
~cDisplayReplaySD();
+
+ virtual void Show(void);
+ virtual eOSState ProcessKey(eKeys Key);
+
+ void Flush();
+ void SetCurrent(const char *Current);
+ void SetMode(bool Play, bool Forward, int Speed);
+
};
diff --git a/hlsPlayer.cpp b/hlsPlayer.cpp
index e58eb28..515ff93 100644
--- a/hlsPlayer.cpp
+++ b/hlsPlayer.cpp
@@ -337,9 +337,9 @@ bool cHlsSegmentLoader::DoLoad(void)
recover = true;
std::string stopUri = "/video/:/transcode/universal/stop?session=" + m_sessionCookie;
try {
- Poco::Net::HTTPResponse reqResponse;
+
bool ok;
- m_pVideo->m_pServer->MakeRequest(reqResponse, ok, stopUri);
+ auto cSession = m_pVideo->m_pServer->MakeRequest(ok, stopUri);
int tmp = m_lastLoadedSegment;
int tmp2 = m_lastSegmentSize;
CloseConnection();
@@ -369,9 +369,8 @@ bool cHlsSegmentLoader::StopLoader(void)
try {
std::string stopUri = "/video/:/transcode/universal/stop?session=" + m_sessionCookie;
- Poco::Net::HTTPResponse reqResponse;
bool ok;
- m_pVideo->m_pServer->MakeRequest(reqResponse, ok, stopUri);
+ auto cSession = m_pVideo->m_pServer->MakeRequest(ok, stopUri);
Cancel();
@@ -410,9 +409,8 @@ void cHlsSegmentLoader::Ping(void)
try {
std::string uri = "/video/:/transcode/universal/ping?session=" + Config::GetInstance().GetUUID();
- Poco::Net::HTTPResponse reqResponse;
bool ok;
- m_pVideo->m_pServer->MakeRequest(reqResponse, ok, uri);
+ auto cSession = m_pVideo->m_pServer->MakeRequest(ok, uri);
} catch(Poco::Exception& exc) {
esyslog("[plex]%s %s ", __FUNCTION__, exc.displayText().c_str());
@@ -678,9 +676,8 @@ void cHlsPlayer::SetAudioTrack(eTrackType Type __attribute__((unused)), const tT
if(streamId > 0) {
std::string uri = "/library/parts/" + std::string(itoa(m_Video.m_Media.m_iPartId)) + "?audioStreamID=" + std::string(itoa(streamId));
- Poco::Net::HTTPResponse resp;
bool ok;
- m_Video.m_pServer->MakeRequest(resp, ok, uri);
+ auto cSession = m_Video.m_pServer->MakeRequest(ok, uri);
if(ok) {
DeviceSetCurrentAudioTrack(eTrackType(ttDolby + 0)); // hacky
DeviceSetAvailableTrack(ttDolby, 0, 0, TrackId->language);
@@ -726,9 +723,8 @@ void cHlsPlayer::ReportProgress(bool stopped)
try {
std::string uri = "/:/progress?key=" + std::string(itoa(m_Video.m_iRatingKey)) + "&identifier=com.plexapp.plugins.library&time=" + std::string(itoa(GetPlayedSeconds()*1000)) + "&state=" + state;
- Poco::Net::HTTPResponse resp;
bool ok;
- m_Video.m_pServer->MakeRequest(resp, ok, uri);
+ auto cSession = m_Video.m_pServer->MakeRequest(ok, uri);
if(ok) {
dsyslog("[plex] %s", __FUNCTION__);
@@ -740,10 +736,9 @@ void cHlsPlayer::ReportProgress(bool stopped)
void cHlsPlayer::SetWatched(void)
{
std::string uri = "/:/scrobble?key=" + std::string(itoa(m_Video.m_iRatingKey)) + "&identifier=com.plexapp.plugins.library";
-
- Poco::Net::HTTPResponse resp;
+
bool ok;
- m_Video.m_pServer->MakeRequest(resp, ok, uri);
+ auto cSession = m_Video.m_pServer->MakeRequest(ok, uri);
if(ok) {
dsyslog("[plex] %s", __FUNCTION__);
diff --git a/pictureCache.cpp b/pictureCache.cpp
index 4dbb992..f821806 100644
--- a/pictureCache.cpp
+++ b/pictureCache.cpp
@@ -28,42 +28,18 @@ cPictureCache::cPictureCache()
m_bAllInvalidated = false;
}
-void cPictureCache::Action()
-{
- while(Running()) {
- while (m_qImagesToLoad.size() > 0) {
- CacheInfo info = m_qImagesToLoad.front();
- m_qImagesToLoad.pop_front();
-
- std::string transcodeUri = TranscodeUri(info.uri, info.width, info.height);
- std::string file = FileName(info.uri, info.width);
- bool ok = true;
- if(!Cached(info.uri, info.width)) {
- ok = DownloadFileAndSave(transcodeUri, file);
- }
- if(ok) {
- LOCK_THREAD;
- if (!m_bAllInvalidated && info.onCached && info.calle && info.calle->IsVisible()) {
- info.onCached(info.calle);
- }
- }
- cCondWait::SleepMs(5);
- }
- cCondWait::SleepMs(100);
- }
-}
-
bool cPictureCache::DownloadFileAndSave(std::string Uri, std::string localFile)
{
try {
Poco::URI fileUri(Uri);
plexclient::PlexServer* pServer = plexclient::plexgdm::GetInstance().GetServer(fileUri.getHost(), fileUri.getPort());
-
- Poco::Net::HTTPResponse response;
+
bool ok;
- std::istream &rs = pServer->MakeRequest(response, ok, fileUri.getPathAndQuery());
-
- if (!ok)
+ auto cSession = pServer->MakeRequest(ok, fileUri.getPathAndQuery());
+ Poco::Net::HTTPResponse response;
+ std::istream &rs = cSession->receiveResponse(response);
+
+ if (!ok || response.getStatus() != 200)
return false;
std::string type = response.getContentType();
@@ -96,9 +72,9 @@ bool cPictureCache::DownloadFileAndSave(std::string Uri, std::string localFile)
outFile.close();
return true;
} catch (Poco::Exception &exc) {
+ std::cout << exc.displayText() << std::endl;
return false;
}
-
}
std::string cPictureCache::FileName(std::string uri, int width)
@@ -138,7 +114,13 @@ std::string cPictureCache::TranscodeUri(std::string uri, int width, int height)
bool cPictureCache::Cached(std::string uri, int width)
{
- return Poco::File(FileName(uri, width) + ".jpg").exists() || Poco::File(FileName(uri, width) + ".png").exists();
+ bool cached = true;
+ try {
+ cached = m_mCached.at(FileName(uri, width));
+ } catch (std::out_of_range) { }
+
+ bool onDisk = Poco::File(FileName(uri, width) + ".jpg").exists() || Poco::File(FileName(uri, width) + ".png").exists();
+ return onDisk && cached;
}
std::string cPictureCache::GetPath(std::string uri, int width, int height, bool& cached, std::function<void(cGridElement*)> OnCached, cGridElement* calle)
@@ -152,44 +134,34 @@ std::string cPictureCache::GetPath(std::string uri, int width, int height, bool&
} else if(Poco::File(FileName(uri, width) + ".png").exists()) {
file += ".png";
}
-
return file;
} else {
- CacheInfo info(uri, width, height, OnCached, calle);
- m_qImagesToLoad.push_back(info);
+
+ try {
+ m_mCached.at(file);
+ return file;
+ } catch (std::out_of_range) { }
+
+ std::string transcodeUri = TranscodeUri(uri, width, height);
+ std::string file = FileName(uri, width);
+
+ m_mCached[file] = false;
+
+ m_vFutures.push_back(std::async(std::launch::async,
+ [&] (std::string tsUri, std::string fn, std::function<void(cGridElement*)> onCached, cGridElement* ca) {
+ bool ok = DownloadFileAndSave(tsUri, fn);
+ if(ok) {
+ m_mCached[fn] = true;
+ }
+ if (ok && onCached && ca && ca->IsVisible()) {
+ onCached(ca);
+ }
+ return;
+ },
+ transcodeUri, file, OnCached, calle) );
}
return file;
}
-void cPictureCache::Stop()
-{
- Cancel();
-}
-
-void cPictureCache::Remove(cGridElement* element)
-{
- if(!element) return;
- if (auto video = dynamic_cast<plexclient::Video*>(element)) {
- Remove(video->ThumbUri());
- Remove(video->ArtUri());
- }
-}
-void cPictureCache::Remove(std::string uri)
-{
- LOCK_THREAD;
- for(std::deque<CacheInfo>::iterator it = m_qImagesToLoad.begin() ; it != m_qImagesToLoad.end(); ++it) {
- if(it->uri == uri) {
- m_qImagesToLoad.erase(it);
- return;
- }
- }
-}
-
-void cPictureCache::RemoveAll()
-{
- LOCK_THREAD;
- m_bAllInvalidated = true;
- m_qImagesToLoad.clear();
-}
diff --git a/pictureCache.h b/pictureCache.h
index 51398e8..e259c6f 100644
--- a/pictureCache.h
+++ b/pictureCache.h
@@ -6,6 +6,7 @@
#include <fstream>
#include <deque>
#include <string>
+#include <future>
#include <vdr/thread.h>
#include <vdr/plugin.h>
@@ -19,7 +20,7 @@ enum ImageResolution {
HD1080
};
-class cPictureCache : public cThread
+class cPictureCache
{
private:
struct CacheInfo {
@@ -35,33 +36,28 @@ private:
int height;
std::function<void(cGridElement*)> onCached;
cGridElement* calle;
+ bool downloaded;
};
cPictureCache();
- std::deque<CacheInfo> m_qImagesToLoad;
+ std::map<std::string, bool> m_mCached;
+ std::vector<std::future<void>> m_vFutures;
volatile bool m_bAllInvalidated;
std::string FileName(std::string uri, int width);
std::string TranscodeUri(std::string uri, int width, int height);
- bool DownloadFileAndSave(std::string uri, std::string localFile);
+ static bool DownloadFileAndSave(std::string uri, std::string localFile);
+ bool Cached(std::string uri, int width);
std::string m_cacheDir;
-protected:
- virtual void Action();
-
public:
static cPictureCache& GetInstance() {
static cPictureCache instance;
return instance;
}
- void Stop();
- bool Cached(std::string uri, int width);
std::string GetPath(std::string uri, int width, int height, bool& cached, std::function<void(cGridElement*)> OnCached = NULL, cGridElement* calle = NULL);
- void Remove(cGridElement* element);
- void Remove(std::string uri);
- void RemoveAll();
};
#endif // CPICTURECACHE_H
diff --git a/plex.cpp b/plex.cpp
index d6e7951..5455914 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -135,12 +135,7 @@ bool cMyPlugin::Start(void)
skindesignerapi::cTokenContainer *tkDetailExtraGrid = new skindesignerapi::cTokenContainer();
cPlexSdOsd::DefineGridTokens(tkDetailExtraGrid);
m_pPlugStruct->RegisterViewGrid((int)eViews::detailView, (int)eViewDetailViewGrids::extras, "extragrid", tkDetailExtraGrid);
-
-
- m_pPlugStructReplay = new skindesignerapi::cPluginStructure();
- m_pPlugStructReplay->name = "plexreplay";
- m_pPlugStructReplay->libskindesignerAPIVersion = LIBSKINDESIGNERAPIVERSION;
- m_pPlugStructReplay->RegisterRootView("root.xml");
+
if (!skindesignerapi::SkindesignerAPI::RegisterPlugin(m_pPlugStruct)) {
esyslog("[plex]: skindesigner not available");
@@ -184,9 +179,6 @@ bool cMyPlugin::Initialize(void)
plexclient::plexgdm::GetInstance().Start();
plexclient::ControlServer::GetInstance().Start();
-#ifdef SKINDESIGNER
- cPictureCache::GetInstance().Start();
-#endif
return true;
}
diff --git a/plex.h b/plex.h
index 8cbda0c..a7317ac 100644
--- a/plex.h
+++ b/plex.h
@@ -47,7 +47,6 @@ class cMyPlugin:public cPlugin
private:
#ifdef SKINDESIGNER
skindesignerapi::cPluginStructure *m_pPlugStruct;
- skindesignerapi::cPluginStructure *m_pPlugStructReplay;
cPlexSdOsd *m_pTestOsd;
static bool bSkindesigner;
#endif
diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp
index dbbea64..5f4f3ee 100644
--- a/plexSdOsd.cpp
+++ b/plexSdOsd.cpp
@@ -20,7 +20,6 @@ cPlexSdOsd::~cPlexSdOsd()
m_pBrowserGrid->Clear();
if(m_pMessage)
m_pMessage->Clear();
- cPictureCache::GetInstance().RemoveAll();
}
bool cPlexSdOsd::SdSupport()
diff --git a/po/de_DE.po b/po/de_DE.po
index e273dac..4a1a03d 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-plex 0.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2016-03-17 20:29+0100\n"
+"POT-Creation-Date: 2016-03-28 18:32+0200\n"
"PO-Revision-Date: 2016-03-09 21:24+0200\n"
"Last-Translator: Chris <zerov83@gmail.com>\n"
"Language-Team: chriszero\n"
diff --git a/viewGridNavigator.cpp b/viewGridNavigator.cpp
index ec92c5f..804e39d 100644
--- a/viewGridNavigator.cpp
+++ b/viewGridNavigator.cpp
@@ -21,6 +21,7 @@ cViewGridNavigator::cViewGridNavigator(std::shared_ptr<skindesignerapi::cOsdView
m_endIndex = 0;
m_newDimensions = true;
m_setIterator = true;
+ m_bEnableRedraw = false;
m_pGrid = NULL;
m_pRootView = rootView;
@@ -36,7 +37,7 @@ void cViewGridNavigator::SetViewGrid(std::shared_ptr<skindesignerapi::cViewGrid>
void cViewGridNavigator::ReDraw(cGridElement* element)
{
- if(m_bHidden) return;
+ if(m_bHidden || !m_bEnableRedraw) return;
if(element) {
cMutexLock MutexLock(&cPlexSdOsd::RedrawMutex);
if (!element->IsVisible()) {
@@ -73,6 +74,7 @@ void cViewGridNavigator::FilterElements(int scrollOffset)
int i = 0;
int pos = 0;
+ m_bEnableRedraw = false;
for(auto it = m_vElements.begin(); it != m_vElements.end(); ++it) {
if(i >= m_startIndex && i < m_endIndex) {
@@ -86,16 +88,14 @@ void cViewGridNavigator::FilterElements(int scrollOffset)
m_setIterator = false;
}
} else {
- m_pGrid->Delete((*it)->GridElementId());
+ if((*it)->Position > -1) m_pGrid->Delete((*it)->GridElementId());
(*it)->Dirty();
(*it)->Position = -1;
(*it)->SetPosition(-1,-1);
- // Remove Queued Downloads
- cPictureCache::GetInstance().Remove(*it);
}
i++;
}
-
+ m_bEnableRedraw = true;
m_newDimensions = false;
}
diff --git a/viewGridNavigator.h b/viewGridNavigator.h
index 1b1ae16..4482d39 100644
--- a/viewGridNavigator.h
+++ b/viewGridNavigator.h
@@ -38,6 +38,7 @@ protected:
int m_rows;
int m_columns;
bool m_bHidden;
+ bool m_bEnableRedraw;
std::shared_ptr<skindesignerapi::cOsdView> m_pRootView;
std::shared_ptr<skindesignerapi::cViewGrid> m_pGrid;