diff options
author | louis <louis.braun@gmx.de> | 2015-06-26 14:47:29 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-06-26 14:47:29 +0200 |
commit | 4d4f81b6e35d9fdee68c169d0d569e178050a475 (patch) | |
tree | c34603636cf4639f2f427659887d2457c81b7681 | |
parent | b234e73ec89687589769b398febbec2a0123c58f (diff) | |
download | vdr-plugin-tvguideng-4d4f81b6e35d9fdee68c169d0d569e178050a475.tar.gz vdr-plugin-tvguideng-4d4f81b6e35d9fdee68c169d0d569e178050a475.tar.bz2 |
added optional intelligent channel switch mode
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | config.c | 1 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | detailview.h | 1 | ||||
-rw-r--r-- | po/de_DE.po | 5 | ||||
-rw-r--r-- | setup.c | 1 | ||||
-rw-r--r-- | tvguidengosd.c | 44 | ||||
-rw-r--r-- | tvguidengosd.h | 4 |
9 files changed, 51 insertions, 12 deletions
@@ -36,3 +36,5 @@ Version 0.1.2 - fixed crash when closing tvguide with active blinking icon Version 0.1.3 + +- added optional intelligent channel switch mode @@ -154,6 +154,10 @@ Setup Options Blue: Channel Switch, Ok: Detailed EPG or Blue: Detailed EPG, Ok: Channel Switch +- "Intelligent" channel switch mode: if set to "no", always a channel switch is + done. If set to "yes", a channel switch is only done for currently running + events (or for events that start in up to five minutes). For future events + a switch timer is created. - Close TVGuide after channel switch: If set to "no", tvguide will not be closed after a channel switch. - Functionality of numeric Keys: see chapter Usage / Remote Control Keys @@ -16,6 +16,7 @@ cTVGuideConfig::cTVGuideConfig(void) { closeOnSwitch = 0; numKeyMode = eChannelJump; blueKeyMode = eBlueKeyFavorites; + intelligentSwitch = 0; //settings for rerun display rerunAmount = 10; rerunDistance = 2; @@ -52,6 +52,7 @@ public: int closeOnSwitch; int numKeyMode; int blueKeyMode; + int intelligentSwitch; int rerunAmount; int rerunDistance; int rerunMaxChannel; diff --git a/detailview.h b/detailview.h index 3697a25..f7685c0 100644 --- a/detailview.h +++ b/detailview.h @@ -32,6 +32,7 @@ public: void Down(void);
bool DrawTime(void);
void Flush(void) { detailView->Display(); };
+ const cEvent *GetEvent(void) { return event; };
};
#endif //__TVGUIDE_DETAILVIEW_H
diff --git a/po/de_DE.po b/po/de_DE.po index 3ca37ee..e45e50c 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguideng 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2015-03-08 17:24+0200\n" +"POT-Creation-Date: 2015-06-26 13:48+0200\n" "PO-Revision-Date: 2015-03-08 17:49+0200\n" "Last-Translator: Louis\n" "Language-Team: \n" @@ -558,6 +558,9 @@ msgstr "Funktion der Nummerntasten" msgid "Keys Blue and OK" msgstr "Tasten Blau und OK" +msgid "\"Intelligent\" channel switch mode" +msgstr "\"Intelligenter\" Kanalumschalt Modus" + msgid "Maximum number of reruns to display" msgstr "Maximale Anzahl dargestellter Wiederholungen" @@ -47,6 +47,7 @@ void cTvGuideSetup::Setup(void) { Add(new cMenuEditBoolItem(tr("Close TVGuide after channel switch"), &tmpConfig.closeOnSwitch)); Add(new cMenuEditStraItem(tr("Functionality of numeric Keys"), &tmpConfig.numKeyMode, 2, numMode)); Add(new cMenuEditStraItem(tr("Keys Blue and OK"), &tmpConfig.blueKeyMode, 3, blueMode)); + Add(new cMenuEditBoolItem(tr("\"Intelligent\" channel switch mode"), &tmpConfig.intelligentSwitch)); Add(new cMenuEditIntItem(tr("Maximum number of reruns to display"), &tmpConfig.rerunAmount, 1, 100)); Add(new cMenuEditIntItem(tr("Minimum timely distance of rerun (in hours)"), &tmpConfig.rerunDistance, 0, 1000)); Add(new cMenuEditIntItem(tr("Limit Channel Numbers for reruns"), &tmpConfig.rerunMaxChannel, 0, 1000, tr("no limit"))); diff --git a/tvguidengosd.c b/tvguidengosd.c index f6cc8d3..7e521d9 100644 --- a/tvguidengosd.c +++ b/tvguidengosd.c @@ -113,7 +113,7 @@ eOSState cTVGuideOSD::ProcessKey(eKeys Key) { CloseDetailedView(); break; case kBlue: - state = ChannelSwitch(); + state = ChannelSwitch(detailView->GetEvent()); break; case kRed: CloseDetailedView(); @@ -399,7 +399,7 @@ void cTVGuideOSD::KeyYellow(void) { eOSState cTVGuideOSD::KeyBlue(const cEvent *e) { if (config.blueKeyMode == eBlueKeySwitch) { - return ChannelSwitch(); + return ChannelSwitch(e); } else if (config.blueKeyMode == eBlueKeyEPG) { DetailView(e); } else if (config.blueKeyMode == eBlueKeyFavorites) { @@ -412,25 +412,49 @@ eOSState cTVGuideOSD::KeyOk(const cEvent *e) { if (config.blueKeyMode == eBlueKeySwitch) { DetailView(e); } else if (config.blueKeyMode == eBlueKeyEPG) { - return ChannelSwitch(); + return ChannelSwitch(e); } else if (config.blueKeyMode == eBlueKeyFavorites) { DetailView(e); } return osContinue; } -eOSState cTVGuideOSD::ChannelSwitch(void) { - const cChannel *currentChannel = epgGrid->GetCurrentChannel(); - if (!currentChannel) { - return osContinue; +eOSState cTVGuideOSD::ChannelSwitch(const cEvent *e) { + bool running = false; + if (e) { + time_t now = time(0); + if (((e->StartTime() - 5*60) <= now) && (e->EndTime() >= now)) + running = true; } - cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true); - if (config.closeOnSwitch) { - return osEnd; + if (running || !config.intelligentSwitch) { + const cChannel *currentChannel = epgGrid->GetCurrentChannel(); + if (!currentChannel) { + return osContinue; + } + cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true); + if (config.closeOnSwitch) { + return osEnd; + } + } else { + CreateSwitchTimer(e); + epgGrid->SetTimers(); + epgGrid->DrawGrid(); + epgGrid->Flush(); } return osContinue; } +void cTVGuideOSD::CreateSwitchTimer(const cEvent *e) { + if (!e) + return; + cSwitchTimer st; + st.switchMinsBefore = 2; + st.announceOnly = 0; + cRecManager recManager; + recManager.SetEPGSearchPlugin(); + recManager.CreateSwitchTimer(e, st); +} + void cTVGuideOSD::DetailView(const cEvent *e) { if (!e) return; diff --git a/tvguidengosd.h b/tvguidengosd.h index af6fb1d..6fb310a 100644 --- a/tvguidengosd.h +++ b/tvguidengosd.h @@ -11,6 +11,7 @@ #include "channeljump.h" #include "detailview.h" #include "recmenuview.h" +#include "recmanager.h" enum eViews { viRootView, @@ -84,7 +85,8 @@ private: void KeyRed(void); void DetailView(const cEvent *e); void CloseDetailedView(void); - eOSState ChannelSwitch(void); + eOSState ChannelSwitch(const cEvent *e); + void CreateSwitchTimer(const cEvent *e); void Favorites(void); public: cTVGuideOSD(void); |