summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-03-05 20:12:32 +0100
committerchriszero <zerov83@gmail.com>2015-03-05 20:12:32 +0100
commit44a091857305a75dcaa16f80f480e3174373c377 (patch)
tree5ab6d90f991221809c4072f12c7e613e6d97c944
parenta37e5ffb71a36ed841ec7f53ae24cca5b441c6d2 (diff)
downloadvdr-plugin-plex-44a091857305a75dcaa16f80f480e3174373c377.tar.gz
vdr-plugin-plex-44a091857305a75dcaa16f80f480e3174373c377.tar.bz2
Scrobble / Unscrobble via PlexBrowser.
-rw-r--r--plex.cpp47
-rw-r--r--plex.h24
-rw-r--r--po/de_DE.mobin0 -> 2980 bytes
-rw-r--r--po/de_DE.po13
4 files changed, 64 insertions, 20 deletions
diff --git a/plex.cpp b/plex.cpp
index da51bed..ecec6d3 100644
--- a/plex.cpp
+++ b/plex.cpp
@@ -2,13 +2,9 @@
#include "SubscriptionManager.h"
#include "plex.h"
-
//////////////////////////////////////////////////////////////////////////////
// cOsdMenu
//////////////////////////////////////////////////////////////////////////////
-
-
-static char ShowBrowser; ///< flag show browser
static std::shared_ptr<plexclient::Plexservice> pPlexService;
std::shared_ptr<plexclient::Plexservice> cPlexBrowser::pLastService;
@@ -75,9 +71,16 @@ eOSState cPlexBrowser::ProcessKey(eKeys key)
// call standard function
state = cOsdMenu::ProcessKey(key);
- //if (state || key != kNone) {
- // dsyslog("[plex]%s: state=%d key=%d\n", __FUNCTION__, state, key);
- //}
+
+ int current = Current(); // get current menu item index
+ cPlexOsdItem *item = static_cast<cPlexOsdItem*>(Get(current));
+
+ if(item->IsVideo()) {
+ if(item->GetAttachedVideo()->m_iViewCount > 0) SetHelp(tr("Info"), tr("Unscrobble"));
+ else SetHelp(tr("Info"), tr("Scrobble"));
+ } else {
+ SetHelp(NULL);
+ }
switch (state) {
case osUnknown:
@@ -86,6 +89,28 @@ eOSState cPlexBrowser::ProcessKey(eKeys key)
return ProcessSelected();
case kBack:
return LevelUp();
+ case kRed:
+ std::cout << "RED";
+ if(item->IsVideo()) {
+ std::cout << " Video Info";
+ }
+ std::cout << std::endl;
+ break;
+ case kGreen:
+ if(item->IsVideo()) {
+ if(item->GetAttachedVideo()->m_iViewCount > 0) {
+ if(item->GetAttachedVideo()->SetUnwatched()) {
+ item->GetAttachedVideo()->UpdateFromServer();
+ }
+ } else {
+ if(item->GetAttachedVideo()->SetWatched()) {
+ item->GetAttachedVideo()->UpdateFromServer();
+ }
+ }
+ }
+ if(item->GetAttachedVideo()->m_iViewCount > 0) SetHelp(tr("Info"), tr("Unscrobble"));
+ else SetHelp(tr("Info"), tr("Scrobble"));
+ break;
default:
break;
}
@@ -105,7 +130,7 @@ eOSState cPlexBrowser::LevelUp()
{
pCont = pService->GetLastSection();
if(!pCont) {
- ShowBrowser = 0;
+ cPlayMenu::eShow = menuShow::MAIN;
return osEnd;
}
cString title = cString::sprintf(tr("Browse Plex - %s"), tr(pCont->m_sTitle1.c_str()));
@@ -187,6 +212,8 @@ eOSState cPlexInfo::ProcessKey(eKeys Key)
// cOsdMenu
//////////////////////////////////////////////////////////////////////////////
+menuShow cPlayMenu::eShow = MAIN;
+
/**
** Play menu constructor.
*/
@@ -241,7 +268,7 @@ eOSState cPlayMenu::ProcessKey(eKeys key)
switch (key) {
case kOk:
pPlexService = item->GetAttachedService();
- ShowBrowser = 1;
+ cPlayMenu::eShow = menuShow::BROWSER;
return osPlugin; // restart with OSD browser
default:
break;
@@ -334,7 +361,7 @@ cOsdObject *cMyPlugin::MainMenuAction(void)
return cPlexBrowser::RecoverLastState();
}
- if (ShowBrowser) {
+ if (cPlayMenu::eShow == menuShow::BROWSER) {
return new cPlexBrowser(tr("Browse Plex"), pPlexService);
}
return new cPlayMenu("Plex");
diff --git a/plex.h b/plex.h
index c2570c8..8c1b15f 100644
--- a/plex.h
+++ b/plex.h
@@ -30,9 +30,9 @@
/// for the distribution archive.
static const char *const VERSION = "0.1.0"
#ifdef GIT_REV
- "-GIT" GIT_REV
+ "-GIT" GIT_REV
#endif
-;
+ ;
static const char *const DESCRIPTION = "Plex for VDR Plugin";
static const char *const MAINMENUENTRY = "Plex for VDR";
@@ -56,14 +56,14 @@ private:
eOSState LevelUp(void);
/// Handle menu item selection
eOSState ProcessSelected();
-
+
static std::shared_ptr<plexclient::Plexservice> pLastService;
static int lastCurrentItem;
public:
cPlexBrowser(const char *title, std::shared_ptr<plexclient::Plexservice> Service);
virtual eOSState ProcessKey(eKeys);
-
+
static cPlexBrowser* RecoverLastState();
};
@@ -76,16 +76,25 @@ public:
virtual eOSState ProcessKey(eKeys Keys);
};
+enum menuShow {
+ MAIN,
+ BROWSER,
+ INFO
+};
+
/**
** Play plugin menu class.
*/
class cPlayMenu:public cOsdMenu
{
+
private:
public:
cPlayMenu(const char *, int = 0, int = 0, int = 0, int = 0, int = 0);
virtual ~ cPlayMenu();
virtual eOSState ProcessKey(eKeys);
+
+ static menuShow eShow;
};
class cMyPlugin:public cPlugin
@@ -101,12 +110,11 @@ public:
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *, const char *);
-
+
static void PlayFile(plexclient::Video Vid);
-
+
public:
- static volatile bool CalledFromCode;
+ static volatile bool CalledFromCode;
};
-
#endif
diff --git a/po/de_DE.mo b/po/de_DE.mo
new file mode 100644
index 0000000..0a3f556
--- /dev/null
+++ b/po/de_DE.mo
Binary files differ
diff --git a/po/de_DE.po b/po/de_DE.po
index ca2ecfc..a283e4e 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-plex 0.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2015-03-01 17:57+0100\n"
-"PO-Revision-Date: 2015-03-01 17:59+0200\n"
+"POT-Creation-Date: 2015-03-05 20:04+0100\n"
+"PO-Revision-Date: 2015-03-05 20:08+0200\n"
"Last-Translator: Chris <zerov83@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: de\n"
@@ -60,6 +60,15 @@ msgstr "Untertitelspuren"
msgid "None"
msgstr "Leer"
+msgid "Info"
+msgstr "Info"
+
+msgid "Unscrobble"
+msgstr "Ungesehen"
+
+msgid "Scrobble"
+msgstr "Gesehen"
+
#, c-format
msgid "Browse Plex - %s"
msgstr "Durchsuche Plex - %s"