From effc63e8104e3331337dcc52d2506938f1871e07 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 11 Oct 2014 10:39:41 +0200 Subject: [PATCH] added setup options to configure rerun display behaviour --- HISTORY | 1 + config.c | 7 +++++++ config.h | 3 +++ po/de_DE.po | 17 ++++++++++++++++- setup.c | 17 ++++++++++++++++- views/displaymenudetailview.c | 27 ++++++++++++++++++++++----- 6 files changed, 65 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index 03fae6a..726b379 100644 --- a/HISTORY +++ b/HISTORY @@ -17,3 +17,4 @@ Version 0.0.2 - added discusage icons to menu header view element so that it discusage can be displayed in every menu view - added numeric day, month and year tokens in different view elements - support for global variables type "double" +- added setup options to configure rerun display behaviour diff --git a/config.c b/config.c index e4d52c6..4deb57a 100644 --- a/config.c +++ b/config.c @@ -16,6 +16,10 @@ cDesignerConfig::cDesignerConfig() { logoWidth = 268; logoHeight = 200; replaceDecPoint = false; + //settings for rerun display + rerunAmount = 10; + rerunDistance = 2; + rerunMaxChannel = 0; } cDesignerConfig::~cDesignerConfig() { @@ -107,6 +111,9 @@ bool cDesignerConfig::SetupParse(const char *Name, const char *Value) { else if (!strcasecmp(Name, "LimitChannelLogoCache")) limitLogoCache = atoi(Value); else if (!strcasecmp(Name, "NumberLogosInitially")) numLogosPerSizeInitial = atoi(Value); else if (!strcasecmp(Name, "NumberLogosMax")) numLogosMax = atoi(Value); + else if (!strcasecmp(Name, "RerunAmount")) rerunAmount = atoi(Value); + else if (!strcasecmp(Name, "RerunDistance")) rerunDistance = atoi(Value); + else if (!strcasecmp(Name, "RerunMaxChannel")) rerunMaxChannel = atoi(Value); else return false; return true; } diff --git a/config.h b/config.h index 9cecd2e..171ce9b 100644 --- a/config.h +++ b/config.h @@ -43,6 +43,9 @@ public: char decPoint; vector skins; vector::iterator skinIterator; + int rerunAmount; + int rerunDistance; + int rerunMaxChannel; }; #ifdef DEFINE_CONFIG bool firstDisplay = true; diff --git a/po/de_DE.po b/po/de_DE.po index e30d229..172d3fd 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-27 11:11+0200\n" +"POT-Creation-Date: 2014-10-11 07:12+0200\n" "PO-Revision-Date: 2014-09-27 11:02+0200\n" "Last-Translator: Louis Braun \n" "Language-Team: \n" @@ -15,6 +15,21 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Reruns" +msgstr "Wiederholungen" + +msgid "Maximum number of reruns to display" +msgstr "Anzahl anzuzeigender Wiederholungen" + +msgid "Minimum timely distance of rerun (in hours)" +msgstr "Zeitl. Abstand der Wiederholung (in h)" + +msgid "Limit Channel Numbers (0 = no limit)" +msgstr "Kanalnummern begrenzen (0 = unbegrenzt)" + +msgid "Image Loading" +msgstr "Bilder" + msgid "Debug Image Loading" msgstr "Debugausgabe für das Laden der Bilder" diff --git a/setup.c b/setup.c index 6809c99..bad237a 100644 --- a/setup.c +++ b/setup.c @@ -13,6 +13,18 @@ void cSkinDesignerSetup::Setup(void) { int current = Current(); Clear(); + cString message = cString::sprintf("---------------- %s ----------------", tr("Reruns")); + Add(new cOsdItem(*message)); + cList::Last()->SetSelectable(false); + + Add(new cMenuEditIntItem(tr("Maximum number of reruns to display"), &data.rerunAmount, 1, 100)); + Add(new cMenuEditIntItem(tr("Minimum timely distance of rerun (in hours)"), &data.rerunDistance, 0, 1000)); + Add(new cMenuEditIntItem(tr("Limit Channel Numbers (0 = no limit)"), &data.rerunMaxChannel, 0, 1000)); + + message = cString::sprintf("---------------- %s ----------------", tr("Image Loading")); + Add(new cOsdItem(*message)); + cList::Last()->SetSelectable(false); + Add(new cMenuEditBoolItem(tr("Debug Image Loading"), &data.debugImageLoading)); Add(new cMenuEditBoolItem(tr("Limit Channel Logo Cache"), &data.limitLogoCache)); @@ -25,7 +37,7 @@ void cSkinDesignerSetup::Setup(void) { return; } - cString message = cString::sprintf("--------------------- %s ---------------------", tr("Cache Statistics")); + message = cString::sprintf("---------------- %s ----------------", tr("Cache Statistics")); Add(new cOsdItem(*message)); cList::Last()->SetSelectable(false); @@ -76,4 +88,7 @@ void cSkinDesignerSetup::Store(void) { SetupStore("LimitChannelLogoCache", config.limitLogoCache); SetupStore("NumberLogosInitially", config.numLogosPerSizeInitial); SetupStore("NumberLogosMax", config.numLogosMax); + SetupStore("RerunAmount", config.rerunAmount); + SetupStore("RerunDistance", config.rerunDistance); + SetupStore("RerunMaxChannel", config.rerunMaxChannel); } \ No newline at end of file diff --git a/views/displaymenudetailview.c b/views/displaymenudetailview.c index e87c0bb..35a34ac 100644 --- a/views/displaymenudetailview.c +++ b/views/displaymenudetailview.c @@ -425,16 +425,18 @@ bool cDisplayMenuDetailView::LoadReruns(vector< map< string, string > > *reruns) if (isempty(event->Title())) return false; - - int maxNumReruns = 10; + + int maxNumReruns = config.rerunAmount; + int rerunDistance = config.rerunDistance * 3600; + int rerunNaxChannel = config.rerunMaxChannel; Epgsearch_searchresults_v1_0 data; string strQuery = event->Title(); - data.useSubTitle = true; data.query = (char *)strQuery.c_str(); data.mode = 0; data.channelNr = 0; data.useTitle = true; + data.useSubTitle = true; data.useDescription = false; bool foundRerun = false; @@ -444,8 +446,24 @@ bool cDisplayMenuDetailView::LoadReruns(vector< map< string, string > > *reruns) foundRerun = true; int i = 0; for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < maxNumReruns; r = list->Next(r)) { - if ((event->ChannelID() == r->event->ChannelID()) && (event->StartTime() == r->event->StartTime())) + time_t eventStart = event->StartTime(); + time_t rerunStart = r->event->StartTime(); + cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true); + //check for identical event + if ((event->ChannelID() == r->event->ChannelID()) && (eventStart == rerunStart)) continue; + //check for timely distance + if (rerunDistance > 0) { + if (rerunStart - eventStart < rerunDistance) { + continue; + } + } + //check for maxchannel + if (rerunNaxChannel > 0) { + if (channel && channel->Number() > rerunNaxChannel) { + continue; + } + } i++; map< string, string > rerun; rerun.insert(pair("reruns[title]", r->event->Title() ? r->event->Title() : "")); @@ -460,7 +478,6 @@ bool cDisplayMenuDetailView::LoadReruns(vector< map< string, string > > *reruns) bool logoExists = imgCache->LogoExists(channelID); rerun.insert(pair("reruns[channellogoexists]", logoExists ? "1" : "0")); - cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true); if (channel) { stringstream channelNumber; channelNumber << channel->Number();