summaryrefslogtreecommitdiff
path: root/p2pvr/daemon/si.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'p2pvr/daemon/si.cpp')
-rw-r--r--p2pvr/daemon/si.cpp42
1 files changed, 33 insertions, 9 deletions
diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp
index 0b93bc4..9164a62 100644
--- a/p2pvr/daemon/si.cpp
+++ b/p2pvr/daemon/si.cpp
@@ -6,6 +6,7 @@
#include <slicer/slicer.h>
#include <logger.h>
+ResourceString(SI_allNetworks, sql_SI_allNetworks);
ResourceString(SI_allDeliveries, sql_SI_allDeliveries);
ResourceString(SI_deliveryForTransport, sql_SI_deliveryForTransport);
ResourceString(SI_deliveryForService, sql_SI_deliveryForService);
@@ -20,6 +21,14 @@ ResourceString(SI_eventsInSchedules, sql_SI_eventsInSchedules);
ResourceString(SI_eventsInRange, sql_SI_eventsInRange);
ResourceString(SI_eventSearch, sql_SI_eventSearch);
+DVBSI::Networks
+SI::GetNetworks(const Ice::Current &)
+{
+ Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::Networks>(
+ *Select(SI_allNetworks).second);
+}
+
P2PVR::Deliveries
SI::GetAllDeliveries(const Ice::Current &)
{
@@ -33,25 +42,40 @@ SI::GetAllDeliveries(const Ice::Current &)
DVBSI::DeliveryPtr
SI::GetDeliveryForTransport(int id, const Ice::Current&)
{
- Logger()->messagef(LOG_DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
- return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::DeliveryPtr>(
- *Select(SI_deliveryForTransport, id).second, "delivery_type");
+ try {
+ Logger()->messagef(LOG_DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::DeliveryPtr>(
+ *Select(SI_deliveryForTransport, id).second, "delivery_type");
+ }
+ catch (const NoRowsReturned &) {
+ throw P2PVR::NotFound();
+ }
}
DVBSI::DeliveryPtr
SI::GetDeliveryForSi(const Ice::Current&)
{
- Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__);
- return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::DeliveryPtr>(
- *Select(SI_serviceNextUsed).second, "delivery_type");
+ try {
+ Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::DeliveryPtr>(
+ *Select(SI_serviceNextUsed).second, "delivery_type");
+ }
+ catch (const NoRowsReturned &) {
+ return NULL;
+ }
}
DVBSI::DeliveryPtr
SI::GetDeliveryForService(int id, const Ice::Current&)
{
- Logger()->messagef(LOG_DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
- return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::DeliveryPtr>(
- *Select(SI_deliveryForService, id).second, "delivery_type");
+ try {
+ Logger()->messagef(LOG_DEBUG, "%s(%d)", __PRETTY_FUNCTION__, id);
+ return Slicer::DeserializeAny<SqlSelectDeserializer, DVBSI::DeliveryPtr>(
+ *Select(SI_deliveryForService, id).second, "delivery_type");
+ }
+ catch (const NoRowsReturned &) {
+ throw P2PVR::NotFound();
+ }
}
DVBSI::ServiceList