diff options
Diffstat (limited to 'p2pvr/daemon/si.cpp')
-rw-r--r-- | p2pvr/daemon/si.cpp | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp index 571c6b0..0c5162e 100644 --- a/p2pvr/daemon/si.cpp +++ b/p2pvr/daemon/si.cpp @@ -9,6 +9,7 @@ ResourceString(SI_serviceNextUsed, sql_SI_serviceNextUsed); ResourceString(SI_servicesSelectAll, sql_SI_servicesSelectAll); ResourceString(SI_servicesSelectById, sql_SI_servicesSelectById); +ResourceString(SI_eventByUid, sql_SI_eventByUid); ResourceString(SI_eventById, sql_SI_eventById); ResourceString(SI_eventsOnNow, sql_SI_eventsOnNow); ResourceString(SI_eventsInSchedule, sql_SI_eventsInSchedule); @@ -100,57 +101,69 @@ SI::GetService(int id, const Ice::Current&) return rtn.front(); } -DVBSI::EventPtr +P2PVR::Events +SI::GetEvents(const P2PVR::IntSequence & eventUids, const Ice::Current &) +{ + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); + BOOST_FOREACH(const auto & uid, eventUids){ + cc.populate(Select(SI_eventByUid, uid).second); + } + if (rtn.size() != eventUids.size()) throw P2PVR::NotFound(); + return rtn; +} + +P2PVR::EventPtr SI::GetEvent(int serviceId, int eventId, const Ice::Current &) { - DVBSI::Events rtn; - SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); cc.populate(Select(SI_eventById, serviceId, eventId).second); if (rtn.empty()) throw P2PVR::NotFound(); return rtn.front(); } -DVBSI::Events +P2PVR::Events SI::EventsOnNow(const Ice::Current &) { - DVBSI::Events rtn; - SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); cc.populate(Select(SI_eventsOnNow).second); return rtn; } -DVBSI::Events +P2PVR::Events SI::EventsInRange(const Common::DateTime & from, const Common::DateTime & to, const Ice::Current &) { - DVBSI::Events rtn; - SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); cc.populate(Select(SI_eventsInRange, from, to).second); return rtn; } -DVBSI::Events +P2PVR::Events SI::EventSearch(const IceUtil::Optional<std::string> & keywords, const IceUtil::Optional<Ice::Int> & serviceId, const IceUtil::Optional<Common::DateTime> & from, const IceUtil::Optional<Common::DateTime> & to, const Ice::Current &) { - DVBSI::Events rtn; - SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); cc.populate(Select(SI_eventSearch, from, to, serviceId, serviceId, keywords, keywords, keywords, keywords).second); return rtn; } -DVBSI::Events +P2PVR::Events SI::EventsInSchedules(const Ice::Current &) { - DVBSI::Events rtn; - SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); cc.populate(Select(SI_eventsInSchedules).second); return rtn; } -DVBSI::Events +P2PVR::Events SI::EventsInSchedule(int scheduleId, const Ice::Current &) { - DVBSI::Events rtn; - SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); + P2PVR::Events rtn; + SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); cc.populate(Select(SI_eventsInSchedule, scheduleId).second); return rtn; } |