added play logging, when the scheduler is executing playlists..

This commit is contained in:
maroy 2005-03-21 12:56:46 +00:00
parent d81d24e8ab
commit 4b6eeadb27
6 changed files with 51 additions and 16 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEvent.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -69,12 +69,14 @@ PlaylistEvent :: PlaylistEvent(
Ptr<SessionId>::Ref sessionId, Ptr<SessionId>::Ref sessionId,
Ptr<AudioPlayerInterface>::Ref audioPlayer, Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<StorageClientInterface>::Ref storage, Ptr<StorageClientInterface>::Ref storage,
Ptr<PlayLogInterface>::Ref playLog,
Ptr<ScheduleEntry>::Ref scheduleEntry) Ptr<ScheduleEntry>::Ref scheduleEntry)
throw () throw ()
{ {
this->sessionId = sessionId; this->sessionId = sessionId;
this->audioPlayer = audioPlayer; this->audioPlayer = audioPlayer;
this->storage = storage; this->storage = storage;
this->playLog = playLog;
this->scheduleEntry = scheduleEntry; this->scheduleEntry = scheduleEntry;
// this init time is a wild guess, say 5 seconds should be enough // this init time is a wild guess, say 5 seconds should be enough
@ -115,6 +117,8 @@ PlaylistEvent :: start(void) throw ()
try { try {
audioPlayer->open(*playlist->getUri()); audioPlayer->open(*playlist->getUri());
audioPlayer->start(); audioPlayer->start();
playLog->addPlayLogEntry(playlist->getId(), TimeConversion::now());
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
// TODO: handle error? // TODO: handle error?

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ 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/PlaylistExecutor/AudioPlayerInterface.h"
#include "LiveSupport/EventScheduler/ScheduledEventInterface.h" #include "LiveSupport/EventScheduler/ScheduledEventInterface.h"
#include "PlayLogInterface.h"
namespace LiveSupport { namespace LiveSupport {
namespace Scheduler { namespace Scheduler {
@ -70,7 +72,7 @@ using namespace LiveSupport::Storage;
* A scheduled event for playing a playlist. * A scheduled event for playing a playlist.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class PlaylistEvent : public virtual ScheduledEventInterface class PlaylistEvent : public virtual ScheduledEventInterface
{ {
@ -80,6 +82,11 @@ class PlaylistEvent : public virtual ScheduledEventInterface
*/ */
Ptr<AudioPlayerInterface>::Ref audioPlayer; Ptr<AudioPlayerInterface>::Ref audioPlayer;
/**
* The play log facility.
*/
Ptr<PlayLogInterface>::Ref playLog;
/** /**
* The storage containing the playlist and all related audio clips. * 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 audioPlayer the audio player to play the playlist with.
* @param storage the storage containing the playlist to play, * @param storage the storage containing the playlist to play,
* and all the related audio clips. * and all the related audio clips.
* @param playLog the play log facility.
* @param scheduleEntry the schedule entry this event is * @param scheduleEntry the schedule entry this event is
* playing. * playing.
*/ */
PlaylistEvent(Ptr<SessionId>::Ref sessionId, PlaylistEvent(Ptr<SessionId>::Ref sessionId,
Ptr<AudioPlayerInterface>::Ref audioPlayer, Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<StorageClientInterface>::Ref storage, Ptr<StorageClientInterface>::Ref storage,
Ptr<PlayLogInterface>::Ref playLog,
Ptr<ScheduleEntry>::Ref scheduleEntry) Ptr<ScheduleEntry>::Ref scheduleEntry)
throw (); throw ();

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventContainer.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -66,13 +66,15 @@ PlaylistEventContainer :: PlaylistEventContainer(
Ptr<SessionId>::Ref sessionId, Ptr<SessionId>::Ref sessionId,
Ptr<StorageClientInterface>::Ref storage, Ptr<StorageClientInterface>::Ref storage,
Ptr<ScheduleInterface>::Ref schedule, Ptr<ScheduleInterface>::Ref schedule,
Ptr<AudioPlayerInterface>::Ref audioPlayer) Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<PlayLogInterface>::Ref playLog)
throw () throw ()
{ {
this->sessionId = sessionId; this->sessionId = sessionId;
this->storage = storage; this->storage = storage;
this->schedule = schedule; this->schedule = schedule;
this->audioPlayer = audioPlayer; this->audioPlayer = audioPlayer;
this->playLog = playLog;
} }
@ -86,7 +88,11 @@ PlaylistEventContainer :: getNextEvent(Ptr<ptime>::Ref when) throw ()
Ptr<PlaylistEvent>::Ref event; Ptr<PlaylistEvent>::Ref event;
if (entry.get()) { if (entry.get()) {
event.reset(new PlaylistEvent(sessionId, audioPlayer, storage, entry)); event.reset(new PlaylistEvent(sessionId,
audioPlayer,
storage,
playLog,
entry));
} }
return event; return event;

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ 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/PlaylistExecutor/AudioPlayerInterface.h"
#include "LiveSupport/EventScheduler/EventContainerInterface.h" #include "LiveSupport/EventScheduler/EventContainerInterface.h"
#include "PlayLogInterface.h"
#include "ScheduleInterface.h" #include "ScheduleInterface.h"
@ -72,7 +73,7 @@ using namespace LiveSupport::Storage;
* An event container holding the scheduled playlists. * An event container holding the scheduled playlists.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
*/ */
class PlaylistEventContainer : public virtual EventContainerInterface class PlaylistEventContainer : public virtual EventContainerInterface
{ {
@ -98,6 +99,11 @@ class PlaylistEventContainer : public virtual EventContainerInterface
*/ */
Ptr<AudioPlayerInterface>::Ref audioPlayer; Ptr<AudioPlayerInterface>::Ref audioPlayer;
/**
* The play log facility.
*/
Ptr<PlayLogInterface>::Ref playLog;
public: public:
/** /**
@ -109,11 +115,13 @@ class PlaylistEventContainer : public virtual EventContainerInterface
* audio clips * audio clips
* @param schedule the schedule to get the events from. * @param schedule the schedule to get the events from.
* @param audioPlayer the audio player to play the playlists with. * @param audioPlayer the audio player to play the playlists with.
* @param playLog the play log facility.
*/ */
PlaylistEventContainer(Ptr<SessionId>::Ref sessionId, PlaylistEventContainer(Ptr<SessionId>::Ref sessionId,
Ptr<StorageClientInterface>::Ref storage, Ptr<StorageClientInterface>::Ref storage,
Ptr<ScheduleInterface>::Ref schedule, Ptr<ScheduleInterface>::Ref schedule,
Ptr<AudioPlayerInterface>::Ref audioPlayer) Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<PlayLogInterface>::Ref playLog)
throw (); throw ();
/** /**

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.21 $ Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $ 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(); audioPlayer = apf->getAudioPlayer();
playLog = plf->getPlayLog();
Ptr<PlaylistEventContainer>::Ref eventContainer; Ptr<PlaylistEventContainer>::Ref eventContainer;
Ptr<time_duration>::Ref granularity; Ptr<time_duration>::Ref granularity;
eventContainer.reset(new PlaylistEventContainer(sessionId, eventContainer.reset(new PlaylistEventContainer(sessionId,
scf->getStorageClient(), scf->getStorageClient(),
sf->getSchedule(), sf->getSchedule(),
audioPlayer)); audioPlayer,
playLog));
// TODO: read granularity from config file // TODO: read granularity from config file
granularity.reset(new time_duration(seconds(1))); granularity.reset(new time_duration(seconds(1)));

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $ Author : $Author: maroy $
Version : $Revision: 1.16 $ Version : $Revision: 1.17 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -88,6 +88,7 @@
#include "LoginMethod.h" #include "LoginMethod.h"
#include "LogoutMethod.h" #include "LogoutMethod.h"
#include "ResetStorageMethod.h" #include "ResetStorageMethod.h"
#include "PlayLogInterface.h"
namespace LiveSupport { namespace LiveSupport {
@ -160,8 +161,8 @@ using namespace LiveSupport::PlaylistExecutor;
* xmlRpcDaemon) &gt; * xmlRpcDaemon) &gt;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: maroy $
* @version $Revision: 1.16 $ * @version $Revision: 1.17 $
* @see ConnectionManagerFactory * @see ConnectionManagerFactory
* @see AuthenticationClientFactory * @see AuthenticationClientFactory
* @see StorageClientFactory * @see StorageClientFactory
@ -200,6 +201,11 @@ class SchedulerDaemon : public Installable,
*/ */
Ptr<AudioPlayerInterface>::Ref audioPlayer; Ptr<AudioPlayerInterface>::Ref audioPlayer;
/**
* The play logging facility.
*/
Ptr<PlayLogInterface>::Ref playLog;
/** /**
* The addAudioClipToPlaylistMethod the daemon is providing. * The addAudioClipToPlaylistMethod the daemon is providing.
*/ */