<%pre> #include #include #include #include using namespace std; using namespace vdrlive; <%args> int channel = -1; <%session scope="global"> bool logged_in(false); <%request scope="page"> cChannel* Channel; <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <%cpp> pageTitle = trVDR("Schedule"); #if VDRVERSNUM < 20301 cSchedulesLock schedulesLock; cSchedules const* schedules = cSchedules::Schedules( schedulesLock ); ReadLock channelsLock( Channels ); if ( !channelsLock ) throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") ); #endif // cChannel* Channel; (see %request above) if ( channel > 0 ) { #if VDRVERSNUM >= 20301 LOCK_CHANNELS_READ; Channel = (cChannel *)Channels->GetByNumber( channel ); #else Channel = Channels.GetByNumber( channel ); #endif } else { #if VDRVERSNUM >= 20301 LOCK_CHANNELS_READ; #endif if (cDevice::CurrentChannel()) { #if VDRVERSNUM >= 20301 Channel = (cChannel *)Channels->GetByNumber(cDevice::CurrentChannel()); #else Channel = Channels.GetByNumber(cDevice::CurrentChannel()); #endif } else { #if VDRVERSNUM >= 20301 Channel = (cChannel *)Channels->Get( Channels->GetNextNormal( -1 ) ); #else Channel = Channels.Get( Channels.GetNextNormal( -1 ) ); #endif } } if ( Channel == 0 ) throw HtmlError( tr("Couldn't find channel or no channels available. Maybe you mistyped your request?") ); cSchedule const* Schedule; #if VDRVERSNUM >= 20301 { LOCK_SCHEDULES_READ; Schedule = Schedules->GetSchedule( (const cChannel *)Channel ); } #else Schedule = schedules->GetSchedule( Channel ); #endif <& pageelems.doc_type &> VDR Live - <$ pageTitle $> <& pageelems.stylesheets &> <& pageelems.ajax_js &> <& pageelems.logo &> <& menu active=("schedule") component=("schedule.channel_selection") &>
<%cpp> if ( Schedule == 0 ) { <$ tr("No schedules available for this channel") $>. <%cpp> } else { <%cpp> string current_day = ""; const cEvent* PresentEvent = Schedule->GetPresentEvent(); time_t now = time(NULL) - ::Setup.EPGLinger * 60; #if VDRVERSNUM >= 20301 for (const cEvent *Event = (cEvent *)Schedule->Events()->First(); Event; Event = (cEvent *)Schedule->Events()->Next(Event)) { #else for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { #endif if (Event->EndTime() <= now && Event != PresentEvent) continue; EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, Event); string title(epgEvent->Title()); string short_description(epgEvent->ShortDescr()); string description(epgEvent->LongDescr()); string start(epgEvent->StartTime(tr("%I:%M %p"))); string end(epgEvent->EndTime(tr("%I:%M %p"))); string day(epgEvent->StartTime(tr("%A, %b %d %Y"))); string epgid = EpgEvents::EncodeDomId(Channel->GetChannelID(), Event->EventID()); bool truncated = false; bool lastEventCurrentDay = false; { #if VDRVERSNUM >= 20301 cEvent* NextEvent = (cEvent *)Schedule->Events()->Next(Event); #else cEvent* NextEvent = Schedule->Events()->Next(Event); #endif if (!NextEvent) { lastEventCurrentDay = true; } else { string nday(NextEvent->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), NextEvent->StartTime()) : ""); lastEventCurrentDay = (day != nday); } } if (current_day != day) { if (current_day != "") { <%cpp> } <%cpp> current_day = day; } <%cpp> }
<$ day $>
"><& pageelems.event_timer epgid=(epgid) &> "><%cpp>if (LiveFeatures().Recent() ) { " alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>><%cpp> } else { <%cpp> } "><& pageelems.imdb_info_href title=(title) &> ">
<$ start $> - <$ end $>
topaligned rightcol ">
<%cpp> }
<%include>page_exit.eh <%def channel_selection>
<& channels_widget name=("channel") selected=(Channel ? *Channel->GetChannelID().ToString() : "") onchange=("document.forms.channels.submit()") &> <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(Channel->GetChannelID()) image="zap.png" alt="" &> <& pageelems.vlc_stream_channel channelId=(Channel->GetChannelID()) &>