From 4b6eeadb27669c3e2046114907a6f1c94f913f73 Mon Sep 17 00:00:00 2001 From: maroy Date: Mon, 21 Mar 2005 12:56:46 +0000 Subject: [PATCH] added play logging, when the scheduler is executing playlists.. --- .../products/scheduler/src/PlaylistEvent.cxx | 6 +++++- livesupport/products/scheduler/src/PlaylistEvent.h | 13 +++++++++++-- .../scheduler/src/PlaylistEventContainer.cxx | 12 +++++++++--- .../scheduler/src/PlaylistEventContainer.h | 14 +++++++++++--- .../products/scheduler/src/SchedulerDaemon.cxx | 8 +++++--- .../products/scheduler/src/SchedulerDaemon.h | 14 ++++++++++---- 6 files changed, 51 insertions(+), 16 deletions(-) diff --git a/livesupport/products/scheduler/src/PlaylistEvent.cxx b/livesupport/products/scheduler/src/PlaylistEvent.cxx index 77a07dfab..c4f8e87a3 100644 --- a/livesupport/products/scheduler/src/PlaylistEvent.cxx +++ b/livesupport/products/scheduler/src/PlaylistEvent.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEvent.cxx,v $ ------------------------------------------------------------------------------*/ @@ -69,12 +69,14 @@ PlaylistEvent :: PlaylistEvent( Ptr::Ref sessionId, Ptr::Ref audioPlayer, Ptr::Ref storage, + Ptr::Ref playLog, Ptr::Ref scheduleEntry) throw () { this->sessionId = sessionId; this->audioPlayer = audioPlayer; this->storage = storage; + this->playLog = playLog; this->scheduleEntry = scheduleEntry; // this init time is a wild guess, say 5 seconds should be enough @@ -115,6 +117,8 @@ PlaylistEvent :: start(void) throw () try { audioPlayer->open(*playlist->getUri()); audioPlayer->start(); + + playLog->addPlayLogEntry(playlist->getId(), TimeConversion::now()); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; // TODO: handle error? diff --git a/livesupport/products/scheduler/src/PlaylistEvent.h b/livesupport/products/scheduler/src/PlaylistEvent.h index 29704e6aa..ef2311a66 100644 --- a/livesupport/products/scheduler/src/PlaylistEvent.h +++ b/livesupport/products/scheduler/src/PlaylistEvent.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEvent.h,v $ ------------------------------------------------------------------------------*/ @@ -46,6 +46,8 @@ #include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h" #include "LiveSupport/EventScheduler/ScheduledEventInterface.h" +#include "PlayLogInterface.h" + namespace LiveSupport { namespace Scheduler { @@ -70,7 +72,7 @@ using namespace LiveSupport::Storage; * A scheduled event for playing a playlist. * * @author $Author: maroy $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class PlaylistEvent : public virtual ScheduledEventInterface { @@ -80,6 +82,11 @@ class PlaylistEvent : public virtual ScheduledEventInterface */ Ptr::Ref audioPlayer; + /** + * The play log facility. + */ + Ptr::Ref playLog; + /** * The storage containing the playlist and all related audio clips. */ @@ -114,12 +121,14 @@ class PlaylistEvent : public virtual ScheduledEventInterface * @param audioPlayer the audio player to play the playlist with. * @param storage the storage containing the playlist to play, * and all the related audio clips. + * @param playLog the play log facility. * @param scheduleEntry the schedule entry this event is * playing. */ PlaylistEvent(Ptr::Ref sessionId, Ptr::Ref audioPlayer, Ptr::Ref storage, + Ptr::Ref playLog, Ptr::Ref scheduleEntry) throw (); diff --git a/livesupport/products/scheduler/src/PlaylistEventContainer.cxx b/livesupport/products/scheduler/src/PlaylistEventContainer.cxx index bbc60d518..2b4d5452e 100644 --- a/livesupport/products/scheduler/src/PlaylistEventContainer.cxx +++ b/livesupport/products/scheduler/src/PlaylistEventContainer.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainer.cxx,v $ ------------------------------------------------------------------------------*/ @@ -66,13 +66,15 @@ PlaylistEventContainer :: PlaylistEventContainer( Ptr::Ref sessionId, Ptr::Ref storage, Ptr::Ref schedule, - Ptr::Ref audioPlayer) + Ptr::Ref audioPlayer, + Ptr::Ref playLog) throw () { this->sessionId = sessionId; this->storage = storage; this->schedule = schedule; this->audioPlayer = audioPlayer; + this->playLog = playLog; } @@ -86,7 +88,11 @@ PlaylistEventContainer :: getNextEvent(Ptr::Ref when) throw () Ptr::Ref event; if (entry.get()) { - event.reset(new PlaylistEvent(sessionId, audioPlayer, storage, entry)); + event.reset(new PlaylistEvent(sessionId, + audioPlayer, + storage, + playLog, + entry)); } return event; diff --git a/livesupport/products/scheduler/src/PlaylistEventContainer.h b/livesupport/products/scheduler/src/PlaylistEventContainer.h index 0074c62f0..eef6a9e5a 100644 --- a/livesupport/products/scheduler/src/PlaylistEventContainer.h +++ b/livesupport/products/scheduler/src/PlaylistEventContainer.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainer.h,v $ ------------------------------------------------------------------------------*/ @@ -45,6 +45,7 @@ #include "LiveSupport/PlaylistExecutor/AudioPlayerInterface.h" #include "LiveSupport/EventScheduler/EventContainerInterface.h" +#include "PlayLogInterface.h" #include "ScheduleInterface.h" @@ -72,7 +73,7 @@ using namespace LiveSupport::Storage; * An event container holding the scheduled playlists. * * @author $Author: maroy $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ class PlaylistEventContainer : public virtual EventContainerInterface { @@ -98,6 +99,11 @@ class PlaylistEventContainer : public virtual EventContainerInterface */ Ptr::Ref audioPlayer; + /** + * The play log facility. + */ + Ptr::Ref playLog; + public: /** @@ -109,11 +115,13 @@ class PlaylistEventContainer : public virtual EventContainerInterface * audio clips * @param schedule the schedule to get the events from. * @param audioPlayer the audio player to play the playlists with. + * @param playLog the play log facility. */ PlaylistEventContainer(Ptr::Ref sessionId, Ptr::Ref storage, Ptr::Ref schedule, - Ptr::Ref audioPlayer) + Ptr::Ref audioPlayer, + Ptr::Ref playLog) throw (); /** diff --git a/livesupport/products/scheduler/src/SchedulerDaemon.cxx b/livesupport/products/scheduler/src/SchedulerDaemon.cxx index 77b3393ba..f6848d12f 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemon.cxx +++ b/livesupport/products/scheduler/src/SchedulerDaemon.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.21 $ + Author : $Author: maroy $ + Version : $Revision: 1.22 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $ ------------------------------------------------------------------------------*/ @@ -271,13 +271,15 @@ SchedulerDaemon :: configure(const xmlpp::Element & element) } audioPlayer = apf->getAudioPlayer(); + playLog = plf->getPlayLog(); Ptr::Ref eventContainer; Ptr::Ref granularity; eventContainer.reset(new PlaylistEventContainer(sessionId, scf->getStorageClient(), sf->getSchedule(), - audioPlayer)); + audioPlayer, + playLog)); // TODO: read granularity from config file granularity.reset(new time_duration(seconds(1))); diff --git a/livesupport/products/scheduler/src/SchedulerDaemon.h b/livesupport/products/scheduler/src/SchedulerDaemon.h index 11d6f3ddb..4084b6c9e 100644 --- a/livesupport/products/scheduler/src/SchedulerDaemon.h +++ b/livesupport/products/scheduler/src/SchedulerDaemon.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: fgerlits $ - Version : $Revision: 1.16 $ + Author : $Author: maroy $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $ ------------------------------------------------------------------------------*/ @@ -88,6 +88,7 @@ #include "LoginMethod.h" #include "LogoutMethod.h" #include "ResetStorageMethod.h" +#include "PlayLogInterface.h" namespace LiveSupport { @@ -160,8 +161,8 @@ using namespace LiveSupport::PlaylistExecutor; * xmlRpcDaemon) > * * - * @author $Author: fgerlits $ - * @version $Revision: 1.16 $ + * @author $Author: maroy $ + * @version $Revision: 1.17 $ * @see ConnectionManagerFactory * @see AuthenticationClientFactory * @see StorageClientFactory @@ -200,6 +201,11 @@ class SchedulerDaemon : public Installable, */ Ptr::Ref audioPlayer; + /** + * The play logging facility. + */ + Ptr::Ref playLog; + /** * The addAudioClipToPlaylistMethod the daemon is providing. */