Displaying reruns in detailed EPG View

This commit is contained in:
louis 2013-05-26 17:44:04 +02:00
parent 6a0447e7a8
commit b3b50abd73
8 changed files with 291 additions and 3 deletions

View File

@ -89,6 +89,9 @@ cTvguideConfig::cTvguideConfig() {
themeIndex = 4;
useBlending = 2;
roundedCorners = 0;
displayRerunsDetailEPGView = 1;
numReruns = 5;
useSubtitleRerun = 1;
}
cTvguideConfig::~cTvguideConfig() {
@ -247,6 +250,9 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "FontGridHorizontalSmallDelta") == 0) FontGridHorizontalSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateHorizontalDelta") == 0) FontTimeLineDateHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value);
else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value);
else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value);
else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value);
else return false;
return true;
}

View File

@ -89,6 +89,9 @@ class cTvguideConfig {
int themeIndex;
int useBlending;
int roundedCorners;
int displayRerunsDetailEPGView;
int numReruns;
int useSubtitleRerun;
void setDynamicValues(int width, int height);
bool SetupParse(const char *Name, const char *Value);
void loadTheme();

View File

@ -1,3 +1,5 @@
#include "services/epgsearch.h"
#include <sstream>
#include "detailview.h"
cDetailView::cDetailView(cGrid *grid) {
@ -10,6 +12,9 @@ cDetailView::cDetailView(cGrid *grid) {
headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines
40 + tvguideConfig.epgImageHeight);
description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
if (tvguideConfig.displayRerunsDetailEPGView) {
LoadReruns();
}
contentScrollable = setContentDrawportHeight();
createPixmaps();
}
@ -26,6 +31,9 @@ cDetailView::~cDetailView(void){
bool cDetailView::setContentDrawportHeight() {
int linesContent = description.Lines() + 1;
if (tvguideConfig.displayRerunsDetailEPGView) {
linesContent += reruns.Lines() + 1;
}
heightContent = linesContent * tvguideConfig.FontDetailView->Height();
if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight))
return true;
@ -97,10 +105,19 @@ void cDetailView::drawContent() {
int textHeight = tvguideConfig.FontDetailView->Height();
int textLines = description.Lines();
for (int i=0; i<textLines; i++) {
int i=0;
for (; i<textLines; i++) {
content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
}
i++;
if (tvguideConfig.displayRerunsDetailEPGView) {
textLines = reruns.Lines();
for (int j=0; j<textLines; j++) {
content->DrawText(cPoint(20, 20 + i*textHeight), reruns.GetLine(j), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
i++;
}
}
}
void cDetailView::drawScrollbar() {
@ -168,6 +185,54 @@ cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColo
return image;
}
void cDetailView::LoadReruns(void) {
cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
if (epgSearchPlugin && !isempty(event->Title())) {
std::stringstream sstrReruns;
Epgsearch_searchresults_v1_0 data;
std::string strQuery = event->Title();
if (tvguideConfig.useSubtitleRerun > 0) {
if (tvguideConfig.useSubtitleRerun == 2 || !isempty(event->ShortText()))
strQuery += "~";
if (!isempty(event->ShortText()))
strQuery += event->ShortText();
data.useSubTitle = true;
} else {
data.useSubTitle = false;
}
data.query = (char *)strQuery.c_str();
data.mode = 0;
data.channelNr = 0;
data.useTitle = true;
data.useDescription = false;
if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
if (list && (list->Count() > 1)) {
sstrReruns << tr("RERUNS OF THIS SHOW") << ':' << std::endl;
int i = 0;
for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < tvguideConfig.numReruns; r = list->Next(r)) {
if ((event->ChannelID() == r->event->ChannelID()) && (event->StartTime() == r->event->StartTime()))
continue;
i++;
sstrReruns << "- "
<< *DayDateTime(r->event->StartTime());
cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true);
if (channel)
sstrReruns << " " << channel->ShortName(true);
sstrReruns << ": " << r->event->Title();
if (!isempty(r->event->ShortText()))
sstrReruns << "~" << r->event->ShortText();
sstrReruns << std::endl;
}
delete list;
}
}
reruns.Set(sstrReruns.str().c_str(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
} else
reruns.Set("", tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
}
void cDetailView::Action(void) {
drawHeader();
drawContent();

View File

@ -19,6 +19,7 @@ private:
int FrameTime;
int FadeTime;
cTextWrapper description;
cTextWrapper reruns;
int borderWidth;
int headerHeight;
bool setContentDrawportHeight();
@ -26,6 +27,7 @@ private:
int heightScrollbar;
bool contentScrollable;
virtual void Action(void);
void LoadReruns(void);
void drawHeader();
void drawContent();
void drawScrollbar();

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-05-24 14:53+0200\n"
"POT-Creation-Date: 2013-05-26 17:37+0200\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
@ -12,6 +12,9 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "RERUNS OF THIS SHOW"
msgstr "Wiederholungen dieser Sendung"
msgid "No EPG Information available"
msgstr "Keine EPG Daten verfügbar"
@ -36,6 +39,15 @@ msgstr "Anzeigeoptionen"
msgid "Fonts and Fontsizes"
msgstr "Schriften und Schriftgrößen"
msgid "never"
msgstr "nie"
msgid "if exists"
msgstr "falls vorhanden"
msgid "always"
msgstr "immer"
msgid "Theme"
msgstr "Theme"
@ -60,6 +72,15 @@ msgstr "Sehr großer Sprung (Tasten 4 / 6) in Stunden"
msgid "Time Format (12h/24h)"
msgstr "Zeitformat (12h/24h)"
msgid "Display Reruns in detailed EPG View"
msgstr "Wiederholungen in der detailierten EPG Ansicht anzeigen"
msgid "Number of reruns to display"
msgstr "Anzahl der dargestellten Wiederholungen"
msgid "Use Subtitle for reruns"
msgstr "Untertitel für Wiederholungssuche nutzen"
msgid "Display Mode"
msgstr "Anzeigemodus"

167
services/epgsearch.h Normal file
View File

@ -0,0 +1,167 @@
/*
Copyright (C) 2004-2007 Christian Wieninger
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
The author can be reached at cwieninger@gmx.de
The project's page is at http://winni.vdr-developer.org/epgsearch
*/
#ifndef EPGSEARCHSERVICES_INC
#define EPGSEARCHSERVICES_INC
// Added by Andreas Mair (mail _AT_ andreas _DOT_ vdr-developer _DOT_ org)
#define EPGSEARCH_SEARCHRESULTS_SERVICE_STRING_ID "Epgsearch-searchresults-v1.0"
#define EPGSEARCH_LASTCONFLICTINFO_SERVICE_STRING_ID "Epgsearch-lastconflictinfo-v1.0"
#include <string>
#include <list>
#include <memory>
#include <set>
#include <vdr/osdbase.h>
// Data structure for service "Epgsearch-search-v1.0"
struct Epgsearch_search_v1_0
{
// in
char* query; // search term
int mode; // search mode (0=phrase, 1=and, 2=or, 3=regular expression)
int channelNr; // channel number to search in (0=any)
bool useTitle; // search in title
bool useSubTitle; // search in subtitle
bool useDescription; // search in description
// out
cOsdMenu* pResultMenu; // pointer to the menu of results
};
// Data structure for service "Epgsearch-exttimeredit-v1.0"
struct Epgsearch_exttimeredit_v1_0
{
// in
cTimer* timer; // pointer to the timer to edit
bool bNew; // flag that indicates, if this is a new timer or an existing one
const cEvent* event; // pointer to the event corresponding to this timer (may be NULL)
// out
cOsdMenu* pTimerMenu; // pointer to the menu of results
};
// Data structure for service "Epgsearch-updatesearchtimers-v1.0"
struct Epgsearch_updatesearchtimers_v1_0
{
// in
bool showMessage; // inform via osd when finished?
};
// Data structure for service "Epgsearch-osdmessage-v1.0"
struct Epgsearch_osdmessage_v1_0
{
// in
char* message; // the message to display
eMessageType type;
};
// Data structure for service "EpgsearchMenu-v1.0"
struct EpgSearchMenu_v1_0
{
// in
// out
cOsdMenu* Menu; // pointer to the menu
};
// Data structure for service "Epgsearch-lastconflictinfo-v1.0"
struct Epgsearch_lastconflictinfo_v1_0
{
// in
// out
time_t nextConflict; // next conflict date, 0 if none
int relevantConflicts; // number of relevant conflicts
int totalConflicts; // total number of conflicts
};
// Data structure for service "Epgsearch-searchresults-v1.0"
struct Epgsearch_searchresults_v1_0
{
// in
char* query; // search term
int mode; // search mode (0=phrase, 1=and, 2=or, 3=regular expression)
int channelNr; // channel number to search in (0=any)
bool useTitle; // search in title
bool useSubTitle; // search in subtitle
bool useDescription; // search in description
// out
class cServiceSearchResult : public cListObject
{
public:
const cEvent* event;
cServiceSearchResult(const cEvent* Event) : event(Event) {}
};
cList<cServiceSearchResult>* pResultList; // pointer to the results
};
// Data structure for service "Epgsearch-switchtimer-v1.0"
struct Epgsearch_switchtimer_v1_0
{
// in
const cEvent* event;
int mode; // mode (0=query existance, 1=add/modify, 2=delete)
// in/out
int switchMinsBefore;
int announceOnly;
// out
bool success; // result
};
// Data structures for service "Epgsearch-services-v1.0"
class cServiceHandler
{
public:
virtual std::list<std::string> SearchTimerList() = 0;
// returns a list of search timer entries in the same format as used in epgsearch.conf
virtual int AddSearchTimer(const std::string&) = 0;
// adds a new search timer and returns its ID (-1 on error)
virtual bool ModSearchTimer(const std::string&) = 0;
// edits an existing search timer and returns success
virtual bool DelSearchTimer(int) = 0;
// deletes search timer with given ID and returns success
virtual std::list<std::string> QuerySearchTimer(int) = 0;
// returns the search result of the searchtimer with given ID in the same format as used in SVDRP command 'QRYS' (->MANUAL)
virtual std::list<std::string> QuerySearch(std::string) = 0;
// returns the search result of the searchtimer with given settings in the same format as used in SVDRP command 'QRYS' (->MANUAL)
virtual std::list<std::string> ExtEPGInfoList() = 0;
// returns a list of extended EPG categories in the same format as used in epgsearchcats.conf
virtual std::list<std::string> ChanGrpList() = 0;
// returns a list of channel groups maintained by epgsearch
virtual std::list<std::string> BlackList() = 0;
// returns a list of blacklists in the same format as used in epgsearchblacklists.conf
virtual std::set<std::string> DirectoryList() = 0;
// List of all recording directories used in recordings, timers, search timers or in epgsearchdirs.conf
virtual ~cServiceHandler() {}
// Read a setup value
virtual std::string ReadSetupValue(const std::string& entry) = 0;
// Write a setup value
virtual bool WriteSetupValue(const std::string& entry, const std::string& value) = 0;
};
struct Epgsearch_services_v1_0
{
// in/out
std::auto_ptr<cServiceHandler> handler;
};
#endif

22
setup.c
View File

@ -93,6 +93,9 @@ void cTvguideSetup::Store(void) {
SetupStore("FontGridHorizontalSmallDelta", tvguideConfig.FontGridHorizontalSmallDelta);
SetupStore("FontTimeLineDateHorizontalDelta", tvguideConfig.FontTimeLineDateHorizontalDelta);
SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta);
SetupStore("displayRerunsDetailEPGView", tvguideConfig.displayRerunsDetailEPGView);
SetupStore("numReruns", tvguideConfig.numReruns);
SetupStore("useSubtitleRerun", tvguideConfig.useSubtitleRerun);
}
cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cTvguideConfig* data) : cOsdMenu(Title, 30) {
@ -128,10 +131,14 @@ cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu(
blendingMethods[0] = "none";
blendingMethods[1] = "classic";
blendingMethods[2] = "nOpacity style";
useSubtitleRerunTexts[0] = tr("never");
useSubtitleRerunTexts[1] = tr("if exists");
useSubtitleRerunTexts[2] = tr("always");
Set();
}
void cMenuSetupGeneral::Set(void) {
const char *indent = " ";
int currentItem = Current();
Clear();
if (themes.NumThemes())
@ -145,10 +152,25 @@ void cMenuSetupGeneral::Set(void) {
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems));
Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView));
if (tmpTvguideConfig->displayRerunsDetailEPGView) {
Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10));
Add(new cMenuEditStraItem(cString::sprintf("%s%s", indent, tr("Use Subtitle for reruns")), &tmpTvguideConfig->useSubtitleRerun, 3, useSubtitleRerunTexts));
}
SetCurrent(Get(currentItem));
Display();
}
eOSState cMenuSetupGeneral::ProcessKey(eKeys Key) {
eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) {
state = osBack;
} else if (Key != kNone) {
Set();
}
return state;
}
//------------------------------------------------------------------------------------------------------------------
cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Screen Presentation"), data) {

View File

@ -26,9 +26,11 @@ class cMenuSetupSubMenu : public cOsdMenu {
class cMenuSetupGeneral : public cMenuSetupSubMenu {
protected:
virtual eOSState ProcessKey(eKeys Key);
cThemes themes;
const char * blendingMethods[3];
const char * timeFormatItems[2];
const char *useSubtitleRerunTexts[3];
void Set(void);
public:
cMenuSetupGeneral(cTvguideConfig *data);