summaryrefslogtreecommitdiff
path: root/pages/whats_on.ecpp
diff options
context:
space:
mode:
Diffstat (limited to 'pages/whats_on.ecpp')
-rw-r--r--pages/whats_on.ecpp172
1 files changed, 63 insertions, 109 deletions
diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp
index a902ae6..4a7948f 100644
--- a/pages/whats_on.ecpp
+++ b/pages/whats_on.ecpp
@@ -106,7 +106,9 @@ if (type == "now") {
% }
<%cpp>
EpgEvents epgEvents;
+ std::list<EpgInfoPtr> eventList;
+ // collect the broadcasts
if (type != "favs")
{
ReadLock channelsLock( Channels );
@@ -132,68 +134,12 @@ if (type == "now") {
}
EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, Event);
-
- bool truncated = false;
- string truncDescription = StringWordTruncate(epgEvent->LongDescr(), maximumTooltipHintLength, truncated);
- string longDescription = StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), maximumDescriptionLength))
- + "<br/><br/>" + tr("Click to view details.");
- bool lastCurrentChanel = true;
-
- if (mode == "detail") {
-</%cpp>
- <div class="event">
- <div class="station">
- <div><div><div><a href="schedule.html?channel=<$ Channel->Number() $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div></div></div>
- </div>
- <div class="content">
- <div class="tools">
- <& pageelems.epg_tool_box detail=(1) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &>
- </div>
- <div>
- <div class="info"><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
-% if (epgEvent->Elapsed() >= 0) {
- <div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
-% }
- <div class="title withmargin"><$ (epgEvent->Title()) $></div>
- <div class="short withmargin"><$ (epgEvent->ShortDescr()) $></div>
- <div class="description withmargin"><$ truncDescription $></div>
-% if (truncated) {
- <div class="more withmargin"><a <& tooltip.hint text=(longDescription) &><& tooltip.display domId=(epgEvent->Id()) &>><$ tr("more") $> ...</a></div>
-% }
- </div>
- </div>
- </div>
-<%cpp>
- }
- else { // mode == "list"
- lastCurrentChanel = ((Channel->Number() == LiveSetup().GetLastChannel())
- || (!Channels.Next(Channel)));
-</%cpp>
- <tr>
- <& pageelems.epg_tool_box detail=(0) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) lastCurrentChanel=(lastCurrentChanel ? 1 : 0) &>
- <td class="topaligned <? lastCurrentChanel ? "bottomrow"?>">
- <div class="withmargin">
- <div class="nomargin"><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
-% if (epgEvent->Elapsed() >= 0) {
- <div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
-% }
- </div>
- </td>
- <td class="topaligned <? lastCurrentChanel ? "bottomrow"?>">
- <div class="more withmargin"><a
-% if (!longDescription.empty()) {
- <& tooltip.hint text=(longDescription) &><& tooltip.display domId=(epgEvent->Id()) &>
-% }
- ><span class="title"><$ (epgEvent->Title()) $></span><br /><span class="short"><$ (epgEvent->ShortDescr()) $></span></a></div>
- </td>
- <td class="topaligned rightcol <? lastCurrentChanel ? "bottomrow"?>"><div class="station withmargin"><a href="schedule.html?channel=<$ Channel->Number() $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div></td>
- </tr>
-% }
-<%cpp>
- }
+ eventList.push_back(epgEvent);
+ }
}
- }
- else {
+ }
+ else // get favorite broadcasts from epgsearch
+ {
SearchResults results;
SearchTimers timers;
for (SearchTimers::iterator timer = timers.begin(); timer != timers.end(); ++timer) {
@@ -205,68 +151,76 @@ if (type == "now") {
time_t now = time(NULL);
for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) {
long diff = result->StartTime() - now;
- long absdiff = labs(diff);
- if (absdiff >= 24*60*60) continue; // skip broadcasts more than a day away
+ if (labs(diff) >= 24*60*60) continue; // skip broadcasts more than a day away
+ EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(result->GetChannel(), result->GetEvent());
+ eventList.push_back(epgEvent);
+ }
+ }
- string diffstring = string((diff > 0) ? tr("in") : tr("since")) + " ";
- if (absdiff >= (60 * 60))
- diffstring += lexical_cast<std::string>(long(absdiff / (60*60))) + " " + tr("hours");
- else
- diffstring += lexical_cast<std::string>(long(absdiff / 60)) + " " + tr("minutes");
+ // display broadcasts
+ for(std::list<EpgInfoPtr>::iterator i = eventList.begin(); i != eventList.end(); ++i ) {
+ EpgInfoPtr epgEvent = *i;
- string epgId = EpgEvents::EncodeDomId(result->Channel(), result->EventId());
- string channelname = Channels.GetByChannelID(result->Channel())->Name();
- int channelnr = Channels.GetByChannelID(result->Channel())->Number();
- bool truncated = false;
- string truncDescription = StringWordTruncate(result->Description(), maximumTooltipHintLength, truncated);
- string longDescription = StringEscapeAndBreak(StringWordTruncate(result->Description(), maximumDescriptionLength))
- + "<br/><br/>" + tr("Click to view details.");
+ bool truncated = false;
+ string truncDescription = StringWordTruncate(epgEvent->LongDescr(), maximumTooltipHintLength, truncated);
+ string longDescription = StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), maximumDescriptionLength))
+ + "<br/><br/>" + tr("Click to view details.");
+ bool lastCurrentChanel = true;
+ const cChannel* Channel = epgEvent->Channel();
+ if (!Channel) continue;
+ int chNumber = Channel->Number();
- // last result?
- SearchResults::iterator nextres = result;
- bool bottom = (++nextres == results.end());
- if (mode == "list") {
+ if (mode == "detail") {
</%cpp>
- <tr>
- <& pageelems.epg_tool_box detail=(0) epgid=(epgId) title=(result->Title()) startTime=(result->StartTime()) endTime=(result->StopTime()) lastCurrentChanel=(bottom ? 1 : 0) &>
- <td class="topaligned <? bottom ? "bottomrow"?>">
- <div class="withmargin">
- <div class="nomargin"><$ (FormatDateTime(tr("%I:%M %p"), result->StartTime())) $> - <$ (FormatDateTime(tr("%I:%M %p"), result->StopTime())) $></div>
- <$ diffstring $>
- </div>
- </td>
- <td class="topaligned <? bottom ? "bottomrow"?>">
- <div class="more withmargin"><a
-% if (!longDescription.empty()) {
- <& tooltip.hint text=(longDescription) &><& tooltip.display domId=(epgId) &>
-% }
- ><span class="title"><$ (result->Title()) $></span><br /><span class="short"><$ (result->ShortText()) $></span></a></div>
- </td>
- <td class="topaligned rightcol <? bottom ? "bottomrow"?>"><div class="station withmargin"><a href="schedule.html?channel=<$ channelnr $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (channelname) $></a></div></td>
- </tr>
-% } else {
<div class="event">
<div class="station">
- <div><div><div><a href="schedule.html?channel=<$ channelnr $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ channelname $></a></div></div></div>
+ <div><div><div><a href="schedule.html?channel=<$ chNumber $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div></div></div>
</div>
<div class="content">
<div class="tools">
- <& pageelems.epg_tool_box detail=(1) epgid=(epgId) title=(result->Title()) startTime=(result->StartTime()) endTime=(result->StopTime()) &>
+ <& pageelems.epg_tool_box detail=(1) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &>
</div>
<div>
- <div class="info"><$ (FormatDateTime(tr("%I:%M %p"), result->StartTime())) $> - <$ (FormatDateTime(tr("%I:%M %p"), result->StopTime())) $></div>
- <div class="info"><$ diffstring $></div>
- <div class="title withmargin"><$ (result->Title()) $></div>
- <div class="short withmargin"><$ (result->ShortText()) $></div>
+ <div class="info"><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
+% if (epgEvent->Elapsed() >= 0) {
+ <div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
+% }
+ <div class="title withmargin"><$ (epgEvent->Title()) $></div>
+ <div class="short withmargin"><$ (epgEvent->ShortDescr()) $></div>
<div class="description withmargin"><$ truncDescription $></div>
-% if (truncated) {
- <div class="more withmargin"><a <& tooltip.hint text=(longDescription) &><& tooltip.display domId=(epgId) &>><$ tr("more") $> ...</a></div>
-% }
+% if (truncated) {
+ <div class="more withmargin"><a <& tooltip.hint text=(longDescription) &><& tooltip.display domId=(epgEvent->Id()) &>><$ tr("more") $> ...</a></div>
+% }
</div>
</div>
- </div>
-<%cpp> }
- }
+ </div>
+<%cpp>
+ } else { // mode == "list"
+ lastCurrentChanel = ((chNumber == LiveSetup().GetLastChannel()) || (!Channels.Next(Channel)));
+</%cpp>
+ <tr>
+ <& pageelems.epg_tool_box detail=(0) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) lastCurrentChanel=(lastCurrentChanel ? 1 : 0) &>
+ <td class="topaligned <? lastCurrentChanel ? "bottomrow"?>">
+ <div class="withmargin">
+ <div class="nomargin"><$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $></div>
+% if (epgEvent->Elapsed() >= 0) {
+ <div class="progress"><div><& pageelems.progressbar progress=(epgEvent->Elapsed()) &></div></div>
+% }
+ </div>
+ </td>
+ <td class="topaligned <? lastCurrentChanel ? "bottomrow"?>">
+ <div class="more withmargin"><a
+% if (!longDescription.empty()) {
+ <& tooltip.hint text=(longDescription) &><& tooltip.display domId=(epgEvent->Id()) &>
+% }
+ ><span class="title"><$ (epgEvent->Title()) $></span><br /><span class="short"><$ (epgEvent->ShortDescr()) $></span></a>
+ </div>
+ </td>
+ <td class="topaligned rightcol <? lastCurrentChanel ? "bottomrow"?>"><div class="station withmargin"><a href="schedule.html?channel=<$ chNumber $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ (epgEvent->Caption()) $></a></div>
+ </td>
+ </tr>
+% }
+<%cpp>
}
</%cpp>
% if (mode == "list") {