From e07c9021c580d6748db86de385e247adad167172 Mon Sep 17 00:00:00 2001 From: randomdan Date: Sat, 19 Apr 2014 23:43:27 +0000 Subject: Add methods for getting events that are part of schedules --- p2pvr/daemon/si.cpp | 20 ++++++++++++++++++++ p2pvr/daemon/si.h | 2 ++ p2pvr/daemon/sql/SI_eventsInSchedule.sql | 30 ++++++++++++++++++++++++++++++ p2pvr/daemon/sql/SI_eventsInSchedules.sql | 29 +++++++++++++++++++++++++++++ p2pvr/ice/p2pvr.ice | 4 ++++ 5 files changed, 85 insertions(+) create mode 100644 p2pvr/daemon/sql/SI_eventsInSchedule.sql create mode 100644 p2pvr/daemon/sql/SI_eventsInSchedules.sql diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp index dda2275..26f7808 100644 --- a/p2pvr/daemon/si.cpp +++ b/p2pvr/daemon/si.cpp @@ -11,6 +11,8 @@ ResourceString(SI_servicesSelectAll, daemon_sql_SI_servicesSelectAll_sql); ResourceString(SI_servicesSelectById, daemon_sql_SI_servicesSelectById_sql); ResourceString(SI_eventById, daemon_sql_SI_eventById_sql); ResourceString(SI_eventsOnNow, daemon_sql_SI_eventsOnNow_sql); +ResourceString(SI_eventsInSchedule, daemon_sql_SI_eventsInSchedule_sql); +ResourceString(SI_eventsInSchedules, daemon_sql_SI_eventsInSchedules_sql); ResourceString(SI_eventsInRange, daemon_sql_SI_eventsInRange_sql); ResourceString(SI_eventSearch, daemon_sql_SI_eventSearch_sql); @@ -135,3 +137,21 @@ SI::EventSearch(const IceUtil::Optional & keywords, const IceUtil:: return rtn; } +DVBSI::Events +SI::EventsInSchedules(const Ice::Current &) +{ + DVBSI::Events rtn; + SqlContainerCreator cc(rtn); + cc.populate(Select(SI_eventsInSchedules).second); + return rtn; +} + +DVBSI::Events +SI::EventsInSchedule(int scheduleId, const Ice::Current &) +{ + DVBSI::Events rtn; + SqlContainerCreator cc(rtn); + cc.populate(Select(SI_eventsInSchedule, scheduleId).second); + return rtn; +} + diff --git a/p2pvr/daemon/si.h b/p2pvr/daemon/si.h index c4a0f11..dd48d77 100644 --- a/p2pvr/daemon/si.h +++ b/p2pvr/daemon/si.h @@ -16,6 +16,8 @@ class SI : public P2PVR::SI, public DatabaseClient { DVBSI::EventPtr GetEvent(int serviceId, int eventId, const Ice::Current &); DVBSI::Events EventsOnNow(const Ice::Current &); + DVBSI::Events EventsInSchedules(const Ice::Current &); + DVBSI::Events EventsInSchedule(int scheduleId, const Ice::Current &); DVBSI::Events EventsInRange(const Common::DateTime &, const Common::DateTime &, const Ice::Current &); DVBSI::Events EventSearch(const IceUtil::Optional & keywords, const IceUtil::Optional & serviceId, const IceUtil::Optional & from, const IceUtil::Optional & to, const Ice::Current &); }; diff --git a/p2pvr/daemon/sql/SI_eventsInSchedule.sql b/p2pvr/daemon/sql/SI_eventsInSchedule.sql new file mode 100644 index 0000000..3f919a5 --- /dev/null +++ b/p2pvr/daemon/sql/SI_eventsInSchedule.sql @@ -0,0 +1,30 @@ +select e.serviceid, + e.eventid, + e.title, + e.titlelang, + e.subtitle, + e.description, + e.descriptionlang, + e.videoaspect, + e.videoframerate, + e.videohd, + e.audiochannels, + e.audiolanguage, + e.subtitlelanguage, + e.category, + e.subcategory, + e.usercategory, + e.dvbrating, + e.starttime, + e.stoptime, + e.episode, + e.episodes, + e.year, + e.flags, + e.season +from events e, record r +where e.serviceid = r.serviceid +and e.eventid = r.eventid +and r.scheduleid = ? +order by e.serviceid, e.starttime + diff --git a/p2pvr/daemon/sql/SI_eventsInSchedules.sql b/p2pvr/daemon/sql/SI_eventsInSchedules.sql new file mode 100644 index 0000000..bd4637a --- /dev/null +++ b/p2pvr/daemon/sql/SI_eventsInSchedules.sql @@ -0,0 +1,29 @@ +select e.serviceid, + e.eventid, + e.title, + e.titlelang, + e.subtitle, + e.description, + e.descriptionlang, + e.videoaspect, + e.videoframerate, + e.videohd, + e.audiochannels, + e.audiolanguage, + e.subtitlelanguage, + e.category, + e.subcategory, + e.usercategory, + e.dvbrating, + e.starttime, + e.stoptime, + e.episode, + e.episodes, + e.year, + e.flags, + e.season +from events e, record r +where e.serviceid = r.serviceid +and e.eventid = r.eventid +order by e.serviceid, e.starttime + diff --git a/p2pvr/ice/p2pvr.ice b/p2pvr/ice/p2pvr.ice index 7176e72..eb4ebbf 100644 --- a/p2pvr/ice/p2pvr.ice +++ b/p2pvr/ice/p2pvr.ice @@ -110,6 +110,10 @@ module P2PVR { ["project2:rows"] idempotent DVBSI::Events EventsOnNow(); ["project2:rows"] + idempotent DVBSI::Events EventsInSchedules(); + ["project2:rows"] + idempotent DVBSI::Events EventsInSchedule(int scheduleId); + ["project2:rows"] idempotent DVBSI::Events EventsInRange(Common::DateTime from, Common::DateTime to); ["project2:rows"] idempotent DVBSI::Events EventSearch(optional(1) string keywords, optional(2) int serviceId, optional(3) Common::DateTime from, optional(4) Common::DateTime to); -- cgit v1.2.3