From 37043899a114c20b50d26ceb2992c2e670b6024e Mon Sep 17 00:00:00 2001 From: chriszero Date: Sat, 21 Feb 2015 15:33:48 +0100 Subject: Add feature "playmarks" --- PVideo.cpp | 1 + plex.cpp | 36 ++++++++++++++++++++++-------------- plex.h | 2 ++ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/PVideo.cpp b/PVideo.cpp index 881ffe4..22f36e7 100644 --- a/PVideo.cpp +++ b/PVideo.cpp @@ -7,6 +7,7 @@ namespace plexclient Video::Video(Poco::XML::Node* pNode, PlexServer Server, MediaContainer* parent) { m_iMyPlayOffset = 0; + m_lViewoffset = 0; m_Server = Server; NodeIterator it(pNode, Poco::XML::NodeFilter::SHOW_ALL); Poco::XML::Node* pChildNode = it.nextNode(); diff --git a/plex.cpp b/plex.cpp index 0e40847..f9a1a84 100644 --- a/plex.cpp +++ b/plex.cpp @@ -2,19 +2,6 @@ #include "SubscriptionManager.h" #include "plex.h" -/** -** Play a file. -** -** @param filename path and file name -*/ -static void PlayFile(plexclient::Video Vid) -{ - isyslog("[plex]: play file '%s'\n", Vid.m_sKey.c_str()); - cControl* control = cHlsPlayerControl::Create(Vid); - if(control) { - cControl::Launch(control); - } -} ////////////////////////////////////////////////////////////////////////////// // cOsdMenu @@ -111,7 +98,7 @@ eOSState cPlexBrowser::ProcessSelected() if(item->IsVideo()) { - PlayFile(*item->GetAttachedVideo()); + cMyPlugin::PlayFile(*item->GetAttachedVideo()); return osEnd; } @@ -365,4 +352,25 @@ bool cMyPlugin::SetupParse(const char *name, const char *value) return true; } +/** +** Play a file. +** +** @param filename path and file name +*/ +void cMyPlugin::PlayFile(plexclient::Video Vid) +{ + isyslog("[plex]: play file '%s'\n", Vid.m_sKey.c_str()); + if(Vid.m_lViewoffset > 0 ) { + cString message = cString::sprintf(tr("To start from %ld minutes, press Ok."), Vid.m_lViewoffset / 60000); + eKeys response = Skins.Message(eMessageType::mtInfo, message, 5); + if(response == kOk) { + Vid.m_iMyPlayOffset = Vid.m_lViewoffset/1000; + } + } + cControl* control = cHlsPlayerControl::Create(Vid); + if(control) { + cControl::Launch(control); + } +} + VDRPLUGINCREATOR(cMyPlugin); // Don't touch this! diff --git a/plex.h b/plex.h index 8da6111..89075f5 100644 --- a/plex.h +++ b/plex.h @@ -96,6 +96,8 @@ public: virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *, const char *); + + static void PlayFile(plexclient::Video Vid); }; -- cgit v1.2.3