<%pre> #include #include #include #include #include #include "exception.h" #include "setup.h" #include "tools.h" using namespace vdrlive; <%args> int channel = -1; <%request scope="global"> std::string pageTitle( tr("Schedule") ); <%cpp> try { cSchedulesLock schedulesLock; cSchedules const* schedules = cSchedules::Schedules( schedulesLock ); ReadLock channelsLock( Channels ); if ( !channelsLock ) throw HtmlError( tr("Channels"), tr("Couldn't aquire access to channels, please try again later.") ); cChannel* Channel; if ( channel > 0 ) Channel = Channels.GetByNumber( channel ); else Channel = Channels.Get( Channels.GetNextNormal( -1 ) ); if ( Channel == 0 ) throw HtmlError( tr("Channels"), tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); cSchedule const* Schedule = schedules->GetSchedule( Channel ); if ( Schedule == 0 ) throw HtmlError( tr("Schedule"), tr("No schedules available for this channel.") ); tnt::Savepoint spoint( reply ); VDR Live - <$ pageTitle $>
VDR Live! <& menu >
Name() ?>
<& channels_widget name=("channel") selected=(Channel ? *Channel->GetChannelID().ToString() : "") onchange=("document.forms.channels.submit()") &>
<{ bool active_line = false; std::string current_day = ""; const cEvent* PresentEvent = Schedule->GetPresentEvent(); time_t now = time(NULL) - ::Setup.EPGLinger * 60; for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { if (Event->EndTime() <= now && Event != PresentEvent) continue; active_line = !active_line; std::string title(Event->Title() ? Event->Title() : ""); std::string short_description(Event->ShortText() ? Event->ShortText() : ""); std::string description(Event->Description() ? Event->Description() : ""); std::string start(Event->StartTime() ? FormatDateTime(tr("%I:%M %p"), Event->StartTime()) : ""); std::string end(Event->EndTime() ? FormatDateTime(tr("%I:%M %p"), Event->EndTime()) : ""); std::string day(Event->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), Event->StartTime()) : ""); if (current_day != day) { current_day = day; }> % } "> % }
<$ current_day $>
<$ start $> - <$ end $> <$ title $>
<$ short_description $>
 
<%cpp> spoint.commit(); } catch ( HtmlError const& ex ) { cxxtools::QueryParams param = qparam; param.add( "errorTitle", ex.GetTitle() ); param.add( "errorMessage", ex.GetMessage() ); callComp( "error", request, reply, param ); }