summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--p2pvr/Jamfile.jam8
-rw-r--r--p2pvr/ice/Jamfile.jam2
-rw-r--r--p2pvr/ice/converters.cpp33
-rw-r--r--p2pvr/ice/dvbsi.ice2
-rw-r--r--p2pvr/ice/p2pvr.ice8
-rw-r--r--p2pvr/p2/Jamfile.jam18
-rw-r--r--p2pvr/p2/config.cpp50
-rw-r--r--p2pvr/p2/config.h31
-rw-r--r--p2pvr/p2/pch.hpp25
-rw-r--r--p2pvr/p2/views/events.cpp60
-rw-r--r--p2pvr/p2/views/schedules.cpp29
-rw-r--r--p2pvr/p2/views/services.cpp28
-rw-r--r--p2pvr/webfe/.p2config6
-rw-r--r--p2pvr/webfe/datasources/p2pvr.xml4
-rw-r--r--p2pvr/webfe/present/iceTask.xml7
-rw-r--r--p2pvr/webfe/present/iceView.xml10
16 files changed, 78 insertions, 243 deletions
diff --git a/p2pvr/Jamfile.jam b/p2pvr/Jamfile.jam
index 3fe2894..565da4e 100644
--- a/p2pvr/Jamfile.jam
+++ b/p2pvr/Jamfile.jam
@@ -17,6 +17,10 @@ alias p2lib : glibmm : : :
<include>/usr/include/project2/lib
<linkflags>"-lp2lib"
;
+alias p2ice : glibmm : : :
+ <include>/usr/include/project2/ice
+ <linkflags>"-lp2ice"
+;
alias p2daemonlib : glibmm : : :
<cflags>"-I /usr/include/project2/daemon/lib"
<linkflags>"-lp2daemonlib"
@@ -25,8 +29,8 @@ build-project streamer ;
build-project daemon ;
build-project carddaemon ;
-install debuginstall : lib//p2pvrlib util//p2pvrutil p2//p2pvrp2 carddaemon daemon ice streamer//streamer : <location>./testing ;
-package.install install : : : carddaemon daemon p2//p2pvrp2 ;
+install debuginstall : lib//p2pvrlib util//p2pvrutil carddaemon daemon ice streamer//streamer : <location>./testing ;
+package.install install : : : carddaemon daemon ;
import type ;
import generators ;
diff --git a/p2pvr/ice/Jamfile.jam b/p2pvr/ice/Jamfile.jam
index c5031bd..cc97614 100644
--- a/p2pvr/ice/Jamfile.jam
+++ b/p2pvr/ice/Jamfile.jam
@@ -8,7 +8,9 @@ lib p2pvrice :
<library>Ice
<library>IceUtil
<library>pthread
+ <library>..//p2common
<library>..//p2lib
+ <library>..//p2ice
: :
<include>.
<library>Ice
diff --git a/p2pvr/ice/converters.cpp b/p2pvr/ice/converters.cpp
new file mode 100644
index 0000000..94f2353
--- /dev/null
+++ b/p2pvr/ice/converters.cpp
@@ -0,0 +1,33 @@
+#include <variableType.h>
+#include <common.h>
+#include <iceConvert.h>
+#include "commonHelpers.h"
+
+template<>
+VariableType
+IceConvert<Common::DateTime>::ToVariable(const Common::DateTime & dt)
+{
+ return *dt;
+}
+
+template<>
+VariableType
+IceConvert<Common::Duration>::ToVariable(const Common::Duration & d)
+{
+ return *d;
+}
+
+template<>
+Common::DateTime
+IceConvert<Common::DateTime>::FromVariable(const VariableType & dt)
+{
+ return *dt.as<boost::posix_time::ptime>();
+}
+
+template<>
+Common::Duration
+IceConvert<Common::Duration>::FromVariable(const VariableType & d)
+{
+ return *d.as<boost::posix_time::time_duration>();
+}
+
diff --git a/p2pvr/ice/dvbsi.ice b/p2pvr/ice/dvbsi.ice
index 8cf6527..7978d3f 100644
--- a/p2pvr/ice/dvbsi.ice
+++ b/p2pvr/ice/dvbsi.ice
@@ -83,6 +83,7 @@ module DVBSI {
BouquetTransportStreamList Streams;
};
+ ["project2:type"]
class Service {
int ServiceId;
int TransportStreamId;
@@ -121,6 +122,7 @@ module DVBSI {
int OriginalNetworkId;
};
+ ["project2:type"]
class Event {
int ServiceId;
int EventId;
diff --git a/p2pvr/ice/p2pvr.ice b/p2pvr/ice/p2pvr.ice
index 75bfbf8..61c0e32 100644
--- a/p2pvr/ice/p2pvr.ice
+++ b/p2pvr/ice/p2pvr.ice
@@ -65,16 +65,19 @@ module P2PVR {
interface Recordings {
idempotent int NewRecording(Recording rec);
+ ["project2:task"]
idempotent void DeleteRecording(int recordingId);
idempotent RecordingList GetRecordings();
};
interface Schedules {
+ ["project2:task"]
idempotent void DeleteSchedule(int scheduleId);
idempotent Schedule GetSchedule(int scheduleId);
idempotent ScheduleList GetSchedules();
idempotent ScheduledToRecordList GetScheduledToRecord();
idempotent int UpdateSchedule(Schedule newSchedule);
+ ["project2:task"]
idempotent void DoReschedule();
};
@@ -86,11 +89,16 @@ module P2PVR {
idempotent DVBSI::Delivery GetDeliveryForTransport(int id);
idempotent DVBSI::Delivery GetDeliveryForSi();
// Get services
+ ["project2:rows"]
idempotent DVBSI::ServiceList GetServices();
+ ["project2:rows"]
idempotent DVBSI::Service GetService(int id);
// Get events
+ ["project2:rows"]
idempotent DVBSI::Event GetEvent(int serviceId, int eventId);
+ ["project2:rows"]
idempotent DVBSI::Events EventsOnNow();
+ ["project2:rows"]
idempotent DVBSI::Events EventsInRange(Common::DateTime from, Common::DateTime to);
};
diff --git a/p2pvr/p2/Jamfile.jam b/p2pvr/p2/Jamfile.jam
deleted file mode 100644
index f81ee60..0000000
--- a/p2pvr/p2/Jamfile.jam
+++ /dev/null
@@ -1,18 +0,0 @@
-cpp-pch pch : pch.hpp :
- <library>../ice//p2pvrice
- <library>..//p2common
- <library>..//p2lib
- <implicit-dependency>../ice//p2pvrice
-;
-
-lib p2pvrp2 :
- pch
- [ glob-tree *.cpp ]
- :
- <library>../ice//p2pvrice
- <library>../util//p2pvrutil
- <library>..//p2common
- <library>..//p2lib
- <implicit-dependency>../ice//p2pvrice
-;
-
diff --git a/p2pvr/p2/config.cpp b/p2pvr/p2/config.cpp
deleted file mode 100644
index 49022b7..0000000
--- a/p2pvr/p2/config.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "config.h"
-#include <logger.h>
-#include <Ice/Ice.h>
-
-std::string Config::DaemonAddress;
-std::string Config::CommunicatorArgs;
-Ice::CommunicatorPtr Config::ic;
-Ice::ObjectAdapterPtr Config::adapter;
-
-DECLARE_OPTIONS(Config, "P2PVR Client options")
-("p2pvr.client.daemonaddress", Options::value(&DaemonAddress),
- "The ICE address of the P2PVR daemon")
-("p2pvr.client.communicatorargs", Options::value(&CommunicatorArgs),
- "Arguments to pass to the client's ICE Communicator")
-END_OPTIONS(Config);
-
-
-DECLARE_COMPONENT("P2PVR Client Config", Config);
-
-void
-Config::onConfigLoad()
-{
- if (ic) {
- Logger()->messagef(LOG_DEBUG, "%s: Destroying existing ICE Communicator", __PRETTY_FUNCTION__);
- ic->shutdown();
- }
- Logger()->messagef(LOG_DEBUG, "%s: Creating new ICE Communicator", __PRETTY_FUNCTION__);
- int argc = 0;
- char ** argv = {};
- ic = Ice::initialize(argc, argv);
- try {
- if (!ic) {
- Logger()->message(LOG_ERR, "Failed to initialize ICE Communicator");
- throw std::runtime_error("Failed to initialize ICE Communicator");
- }
- Logger()->messagebf(LOG_DEBUG, "%s: Creating new default adapter for Communicator", __PRETTY_FUNCTION__);
- adapter = ic->createObjectAdapterWithEndpoints("DefaultAdapter", "default -p 10002");
- if (!adapter) {
- Logger()->message(LOG_ERR, "Failed to create new adapter");
- throw std::runtime_error("Failed to create new adapter");
- }
- Logger()->messagef(LOG_DEBUG, "%s: Activating", __PRETTY_FUNCTION__);
- adapter->activate();
- Logger()->messagef(LOG_DEBUG, "%s: Done", __PRETTY_FUNCTION__);
- }
- catch (const Ice::Exception & ie) {
- Logger()->messagebf(LOG_DEBUG, "%s: ICE initialization failed (%s)", __PRETTY_FUNCTION__, ie);
- }
-}
-
diff --git a/p2pvr/p2/config.h b/p2pvr/p2/config.h
deleted file mode 100644
index 56d8b53..0000000
--- a/p2pvr/p2/config.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef P2PVRP2_CONFIG_H
-#define P2PVRP2_CONFIG_H
-
-#include <options.h>
-#include <componentLoader.h>
-#include <Ice/Communicator.h>
-#include <Ice/ObjectAdapter.h>
-
-class Config : public ComponentLoader {
- public:
- static Ice::ObjectAdapterPtr Adapter();
- static Ice::CommunicatorPtr Communicator();
- template <typename Proxy>
- static Proxy GetProxy(const std::string & interface)
- {
- return Proxy::checkedCast(ic->stringToProxy(interface + ":" + DaemonAddress));
- }
-
- INITOPTIONS;
- void onConfigLoad();
-
- static std::string DaemonAddress;
- static std::string CommunicatorArgs;
-
- private:
- static Ice::CommunicatorPtr ic;
- static Ice::ObjectAdapterPtr adapter;
-};
-
-#endif
-
diff --git a/p2pvr/p2/pch.hpp b/p2pvr/p2/pch.hpp
deleted file mode 100644
index 5ba7bd7..0000000
--- a/p2pvr/p2/pch.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifdef BOOST_BUILD_PCH_ENABLED
-#ifndef P2PVRP2_PCH
-#define P2PVRP2_PCH
-
-#include <Ice/Ice.h>
-#include <boost/bind.hpp>
-#include <boost/foreach.hpp>
-#include <boost/function.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <list>
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include <variableType.h>
-
-#include <p2pvr.h>
-
-#endif
-#endif
-
-
diff --git a/p2pvr/p2/views/events.cpp b/p2pvr/p2/views/events.cpp
deleted file mode 100644
index f435731..0000000
--- a/p2pvr/p2/views/events.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <pch.hpp>
-#include <p2pvr.h>
-#include <p2Helpers.h>
-#include <logger.h>
-#include <rowSet.h>
-#include <genLoader.h>
-#include <execContext.h>
-#include <objectRowState.h>
-#include "../config.h"
-
-class EventsOnNow : public RowSet {
- public:
- EventsOnNow(ScriptNodePtr p) :
- RowSet(p)
- {
- }
-
- void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext *) const
- {
- auto proxy = Config::GetProxy<P2PVR::SIPrx>("SI");
- auto services = proxy->EventsOnNow();
- ObjectRowState<DVBSI::EventPtr> rs;
- BOOST_FOREACH(const auto & s, services) {
- BindColumns(rs, s);
- rs.process(rp);
- }
- }
-};
-
-DECLARE_LOADER("eventsonnow", EventsOnNow);
-
-class EventsInRange : public RowSet {
- public:
- EventsInRange(ScriptNodePtr p) :
- RowSet(p),
- From(p, "from"),
- To(p, "to")
- {
- }
-
- void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const
- {
- auto proxy = Config::GetProxy<P2PVR::SIPrx>("SI");
- Common::DateTime from, to;
- From(ec) >> from;
- To(ec) >> to;
- auto services = proxy->EventsInRange(from, to);
- ObjectRowState<DVBSI::EventPtr> rs;
- BOOST_FOREACH(const auto & s, services) {
- BindColumns(rs, s);
- rs.process(rp);
- }
- }
- private:
- const Variable From;
- const Variable To;
-};
-
-DECLARE_LOADER("eventsinrange", EventsInRange);
-
diff --git a/p2pvr/p2/views/schedules.cpp b/p2pvr/p2/views/schedules.cpp
deleted file mode 100644
index 2c2d020..0000000
--- a/p2pvr/p2/views/schedules.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <pch.hpp>
-#include <p2pvr.h>
-#include <logger.h>
-#include <rowSet.h>
-#include <genLoader.h>
-#include <objectRowState.h>
-#include "../config.h"
-
-class ScheduleList : public RowSet {
- public:
- ScheduleList(ScriptNodePtr p) :
- RowSet(p)
- {
- }
-
- void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext *) const
- {
- auto proxy = Config::GetProxy<P2PVR::SchedulesPrx>("Schedules");
- auto schedules = proxy->GetSchedules();
- ObjectRowState<P2PVR::SchedulePtr> rs;
- BOOST_FOREACH(const auto & s, schedules) {
- BindColumns(rs, s);
- rs.process(rp);
- }
- }
-};
-
-DECLARE_LOADER("schedulelist", ScheduleList);
-
diff --git a/p2pvr/p2/views/services.cpp b/p2pvr/p2/views/services.cpp
deleted file mode 100644
index 2fb4c9d..0000000
--- a/p2pvr/p2/views/services.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <pch.hpp>
-#include <p2pvr.h>
-#include <logger.h>
-#include <rowSet.h>
-#include <genLoader.h>
-#include <objectRowState.h>
-#include "../config.h"
-
-class ServiceList : public RowSet {
- public:
- ServiceList(ScriptNodePtr p) :
- RowSet(p)
- {
- }
-
- void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext *) const
- {
- auto proxy = Config::GetProxy<P2PVR::SIPrx>("SI");
- auto services = proxy->GetServices();
- ObjectRowState<DVBSI::ServicePtr> rs;
- BOOST_FOREACH(const auto & s, services) {
- BindColumns(rs, s);
- rs.process(rp);
- }
- }
-};
-
-DECLARE_LOADER("servicelist", ServiceList);
diff --git a/p2pvr/webfe/.p2config b/p2pvr/webfe/.p2config
new file mode 100644
index 0000000..f5ea06f
--- /dev/null
+++ b/p2pvr/webfe/.p2config
@@ -0,0 +1,6 @@
+ice.client.sliceclient = ice/common.ice
+library = libp2pvrice.so
+ice.client.sliceclient = ice/dvbsi.ice
+ice.client.sliceclient = ice/dvb.ice
+ice.client.sliceclient = ice/p2pvr.ice
+
diff --git a/p2pvr/webfe/datasources/p2pvr.xml b/p2pvr/webfe/datasources/p2pvr.xml
new file mode 100644
index 0000000..ce98566
--- /dev/null
+++ b/p2pvr/webfe/datasources/p2pvr.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<p2:icedatasource xmlns:p2="http://project2.randomdan.homeip.net" name="p2pvr">
+ <endpoint>tcp -p 10000 -h randomdan.homeip.net -t 5000</endpoint>
+</p2:icedatasource>
diff --git a/p2pvr/webfe/present/iceTask.xml b/p2pvr/webfe/present/iceTask.xml
new file mode 100644
index 0000000..ca3e582
--- /dev/null
+++ b/p2pvr/webfe/present/iceTask.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<block xmlns:p2="http://project2.randomdan.homeip.net">
+<!--
+ <p2:P2TV-Recordings-DeleteRecording recordingId="1" objectId="Recordings" datasource="p2pvr" />
+ -->
+</block>
+
diff --git a/p2pvr/webfe/present/iceView.xml b/p2pvr/webfe/present/iceView.xml
new file mode 100644
index 0000000..8874d83
--- /dev/null
+++ b/p2pvr/webfe/present/iceView.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<block xmlns:p2="http://project2.randomdan.homeip.net" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <p2:P2PVR-SI-EventsOnNow name="eventsOnNow" objectId="SI" datasource="p2pvr" />
+ <p2:P2PVR-SI-EventsInRange name="eventsInRange" objectId="SI" datasource="p2pvr" from="2014-03-11 18:00:00" to="2014-03-11 19:00:00" />
+ <p2:P2PVR-SI-GetServices name="services" objectId="SI" datasource="p2pvr" />
+ <p2:P2PVR-SI-GetService name="service" objectId="SI" datasource="p2pvr" id="4170" />
+ <p2:view source="eventsInRange" recordname="event" rootname="events" />
+</block>
+
+