2013-01-17 13:16:44 +01:00
|
|
|
#include "detailview.h"
|
|
|
|
|
2014-01-11 16:53:23 +01:00
|
|
|
cDetailView::cDetailView(const cEvent *event, cFooter *footer) {
|
2013-07-09 00:17:42 +02:00
|
|
|
this->event = event;
|
2014-01-11 16:53:23 +01:00
|
|
|
this->footer = footer;
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cDetailView::~cDetailView(void){
|
2013-08-25 13:57:10 +02:00
|
|
|
Cancel(-1);
|
|
|
|
while (Active())
|
|
|
|
cCondWait::SleepMs(10);
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
footer->LeaveDetailedViewMode(Channels->GetByChannelID(event->ChannelID()));
|
|
|
|
#else
|
2014-01-11 16:53:23 +01:00
|
|
|
footer->LeaveDetailedViewMode(Channels.GetByChannelID(event->ChannelID()));
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-05-11 09:00:21 +02:00
|
|
|
if (view)
|
|
|
|
delete view;
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
void cDetailView::InitiateView(void) {
|
2018-03-08 13:10:09 +01:00
|
|
|
static cPlugin *pScraper = GetScraperPlugin();
|
2014-05-11 09:00:21 +02:00
|
|
|
ScraperGetEventType call;
|
|
|
|
if (!event)
|
|
|
|
return;
|
|
|
|
call.event = event;
|
2018-03-08 13:10:09 +01:00
|
|
|
if (!pScraper) {
|
2014-05-11 09:00:21 +02:00
|
|
|
view = new cEPGView();
|
2018-03-08 13:10:09 +01:00
|
|
|
} else if (pScraper->Service("GetEventType", &call)) {
|
2014-05-11 09:00:21 +02:00
|
|
|
if (call.type == tMovie) {
|
|
|
|
view = new cMovieView(call.movieId);
|
|
|
|
} else if (call.type == tSeries) {
|
|
|
|
view = new cSeriesView(call.seriesId, call.episodeId);
|
2014-01-11 16:53:23 +01:00
|
|
|
}
|
2013-12-21 11:25:03 +01:00
|
|
|
} else {
|
2014-05-11 09:00:21 +02:00
|
|
|
view = new cEPGView();
|
|
|
|
}
|
|
|
|
view->SetTitle(event->Title());
|
|
|
|
view->SetSubTitle(event->ShortText());
|
|
|
|
view->SetInfoText(event->Description());
|
|
|
|
cString dateTime;
|
|
|
|
time_t vps = event->Vps();
|
|
|
|
if (vps) {
|
|
|
|
dateTime = cString::sprintf("%s %s - %s (%d %s) VPS: %s", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60, tr("min"), *TimeString(vps));
|
2013-07-20 13:46:26 +02:00
|
|
|
} else {
|
2014-05-11 09:00:21 +02:00
|
|
|
dateTime = cString::sprintf("%s %s - %s (%d %s)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60, tr("min"));
|
2013-07-20 13:46:26 +02:00
|
|
|
}
|
2014-05-11 09:00:21 +02:00
|
|
|
view->SetDateTime(*dateTime);
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
view->SetChannel(Channels->GetByChannelID(event->ChannelID(), true));
|
|
|
|
#else
|
2014-05-11 09:00:21 +02:00
|
|
|
view->SetChannel(Channels.GetByChannelID(event->ChannelID(), true));
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-05-11 09:00:21 +02:00
|
|
|
view->SetEventID(event->EventID());
|
|
|
|
view->SetEvent(event);
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
std::string cDetailView::LoadReruns(void) {
|
|
|
|
if (!event)
|
|
|
|
return "";
|
2013-05-26 11:38:05 +02:00
|
|
|
|
2013-05-26 17:44:04 +02:00
|
|
|
cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
|
2014-05-11 09:00:21 +02:00
|
|
|
if (!epgSearchPlugin)
|
|
|
|
return "";
|
2013-05-26 17:44:04 +02:00
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
if (isempty(event->Title()))
|
|
|
|
return "";
|
|
|
|
|
|
|
|
std::stringstream sstrReruns;
|
|
|
|
sstrReruns << tr("Reruns of ") << "\"" << event->Title() << "\":" << std::endl << std::endl;
|
2013-06-03 09:52:54 +02:00
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
Epgsearch_searchresults_v1_0 data;
|
|
|
|
std::string strQuery = event->Title();
|
2013-08-25 13:57:10 +02:00
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
if (tvguideConfig.displayRerunsDetailEPGView > 0) {
|
|
|
|
if (tvguideConfig.useSubtitleRerun == 2 && !isempty(event->ShortText())) {
|
|
|
|
strQuery += "~";
|
|
|
|
strQuery += event->ShortText();
|
2013-08-25 13:57:10 +02:00
|
|
|
}
|
2014-05-11 09:00:21 +02:00
|
|
|
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;
|
|
|
|
|
|
|
|
bool foundRerun = false;
|
|
|
|
if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
|
|
|
|
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
|
|
|
|
if (list && (list->Count() > 1)) {
|
|
|
|
foundRerun = true;
|
|
|
|
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());
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByChannelID(r->event->ChannelID(), true, true);
|
|
|
|
#else
|
2014-05-11 09:00:21 +02:00
|
|
|
cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-05-11 09:00:21 +02:00
|
|
|
if (channel) {
|
|
|
|
sstrReruns << ", " << trVDR("Channel") << " " << channel->Number() << ":";
|
|
|
|
sstrReruns << " " << channel->ShortName(true);
|
|
|
|
}
|
|
|
|
sstrReruns << "\n" << r->event->Title();
|
|
|
|
if (!isempty(r->event->ShortText()))
|
|
|
|
sstrReruns << "~" << r->event->ShortText();
|
|
|
|
sstrReruns << std::endl << std::endl;
|
2013-06-03 09:52:54 +02:00
|
|
|
}
|
2014-05-11 09:00:21 +02:00
|
|
|
delete list;
|
2013-08-25 13:57:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
if (!foundRerun) {
|
|
|
|
sstrReruns << std::endl << tr("No reruns found");
|
2013-08-25 13:57:10 +02:00
|
|
|
}
|
2014-05-11 09:00:21 +02:00
|
|
|
return sstrReruns.str();
|
2013-08-25 13:57:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-11 09:00:21 +02:00
|
|
|
void cDetailView::Action(void) {
|
|
|
|
InitiateView();
|
|
|
|
if (!view)
|
2013-08-25 13:57:10 +02:00
|
|
|
return;
|
2014-05-11 09:00:21 +02:00
|
|
|
view->SetFonts();
|
|
|
|
view->SetGeometry();
|
|
|
|
view->LoadMedia();
|
|
|
|
view->Start();
|
|
|
|
if (event)
|
|
|
|
view->SetAdditionalInfoText(LoadReruns());
|
2013-08-25 13:57:10 +02:00
|
|
|
}
|
|
|
|
|
2013-07-09 00:17:42 +02:00
|
|
|
eOSState cDetailView::ProcessKey(eKeys Key) {
|
|
|
|
eOSState state = osContinue;
|
2014-05-11 09:00:21 +02:00
|
|
|
if (Running())
|
|
|
|
return state;
|
2013-07-09 00:17:42 +02:00
|
|
|
switch (Key & ~k_Repeat) {
|
2014-05-11 09:00:21 +02:00
|
|
|
case kUp: {
|
|
|
|
bool scrolled = view->KeyUp();
|
|
|
|
if (scrolled) {
|
|
|
|
view->DrawScrollbar();
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
case kDown: {
|
|
|
|
bool scrolled = view->KeyDown();
|
|
|
|
if (scrolled) {
|
|
|
|
view->DrawScrollbar();
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
|
|
|
break; }
|
2013-07-17 16:43:57 +02:00
|
|
|
case kLeft:
|
2014-05-11 09:00:21 +02:00
|
|
|
view->KeyLeft();
|
|
|
|
view->Start();
|
2013-07-17 16:43:57 +02:00
|
|
|
break;
|
|
|
|
case kRight:
|
2014-05-11 09:00:21 +02:00
|
|
|
view->KeyRight();
|
|
|
|
view->Start();
|
2013-07-17 16:43:57 +02:00
|
|
|
break;
|
2013-07-09 00:17:42 +02:00
|
|
|
case kOk:
|
|
|
|
case kBack:
|
|
|
|
state = osEnd;
|
2013-05-26 11:38:05 +02:00
|
|
|
break;
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
return state;
|
2013-01-17 13:16:44 +01:00
|
|
|
}
|