<%pre> #include #include #include "stdext.h" #include "exception.h" #include "setup.h" #include "tools.h" #include "epg_events.h" #include "recman.h" namespace vdrlive { class SchedulesLock { public: SchedulesLock() : m_schedulesLock() {} operator cSchedulesLock& () { return m_schedulesLock; } private: SchedulesLock(SchedulesLock const &schedulesLock) {} cSchedulesLock m_schedulesLock; }; typedef std::tr1::shared_ptr SchedulesLockPtr; } using namespace vdrlive; using namespace std; <%args> string epgid; string async; <%session scope="global"> bool logged_in(false); <%request scope="page"> EpgInfoPtr epgEvent; <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); pageTitle = tr("Electronic program guide information"); bool ajaxReq = !async.empty() && (lexical_cast(async) != 0); bool aboutBox = false; // One of these get initialized when needed. When freed by getting // out of scope they will release (if initialized) important // Semaphores/Locks. SchedulesLockPtr schedulesLockPtr; RecordingsManagerPtr recordings; if (!epgid.empty()) { const string recording("recording_"); const string event("event_"); const string aboutbox("aboutBox"); // check for recording: if (epgid.compare(0, recording.length(), recording) == 0) { recordings = LiveRecordingsManager(); const cRecording* recording = recordings->GetByMd5Hash(epgid); if (recording == 0) { throw HtmlError(tr("Couldn't find recording or no recordings available")); } epgEvent = EpgEvents::CreateEpgInfo(epgid, recording); } // check for event: else if (epgid.compare(0, event.length(), event) == 0) { schedulesLockPtr = SchedulesLockPtr(new SchedulesLock); if (!schedulesLockPtr) { throw HtmlError(tr("Error aquiring schedules lock")); } const cSchedules* schedules = cSchedules::Schedules(*schedulesLockPtr); if (!schedules) { throw HtmlError(tr("Error aquiring schedules")); } epgEvent = EpgEvents::CreateEpgInfo(epgid, schedules); } // check for aboutbox: else if (epgid.compare(0, aboutbox.length(), aboutbox) == 0) { aboutBox = true; } } <& pageelems.doc_type &> VDR-Live - <$ pageTitle $> <%cpp> if (!ajaxReq) { <& pageelems.stylesheets &> <& pageelems.ajax_js &> <%cpp> } <%cpp> if (!ajaxReq) { <& pageelems.logo &> <& menu &> <%cpp> }
<%cpp> if (epgEvent) { string start(epgEvent->StartTime("%a,") + string(" ") + epgEvent->StartTime(tr("%b %d %y")) + string(" ") + epgEvent->StartTime(tr("%I:%M %p"))); string tools_component; if (recordings) { tools_component = epgEvent->Archived().empty() ? "recordings.rec_tools" : "recordings.archived_disc" ; } if (schedulesLockPtr) { tools_component = "epginfo.epgTools"; } <& pageelems.epg_tt_box boxId=(epgEvent->Id()) caption=(epgEvent->Caption()) tools_comp=(tools_component) time=(start) title=(epgEvent->Title()) short_descr=(epgEvent->ShortDescr()) long_descr=(epgEvent->LongDescr()) archived=(epgEvent->Archived()) elapsed=(epgEvent->Elapsed()) &> <%cpp> } if (aboutBox) { <& pageelems.about_tt_box &> <%cpp> }
<%include>page_exit.eh <# ---------------------------------------------------------------------- #> <%def epgTools> <%args> string id; string title; int detail; <& pageelems.epg_tool_box detail=(detail) epgid=(id) title=(title) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &>