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 $
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<SessionId>::Ref sessionId,
Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<StorageClientInterface>::Ref storage,
Ptr<PlayLogInterface>::Ref playLog,
Ptr<ScheduleEntry>::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?

View file

@ -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<AudioPlayerInterface>::Ref audioPlayer;
/**
* The play log facility.
*/
Ptr<PlayLogInterface>::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<SessionId>::Ref sessionId,
Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<StorageClientInterface>::Ref storage,
Ptr<PlayLogInterface>::Ref playLog,
Ptr<ScheduleEntry>::Ref scheduleEntry)
throw ();

View file

@ -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<SessionId>::Ref sessionId,
Ptr<StorageClientInterface>::Ref storage,
Ptr<ScheduleInterface>::Ref schedule,
Ptr<AudioPlayerInterface>::Ref audioPlayer)
Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<PlayLogInterface>::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<ptime>::Ref when) throw ()
Ptr<PlaylistEvent>::Ref event;
if (entry.get()) {
event.reset(new PlaylistEvent(sessionId, audioPlayer, storage, entry));
event.reset(new PlaylistEvent(sessionId,
audioPlayer,
storage,
playLog,
entry));
}
return event;

View file

@ -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<AudioPlayerInterface>::Ref audioPlayer;
/**
* The play log facility.
*/
Ptr<PlayLogInterface>::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<SessionId>::Ref sessionId,
Ptr<StorageClientInterface>::Ref storage,
Ptr<ScheduleInterface>::Ref schedule,
Ptr<AudioPlayerInterface>::Ref audioPlayer)
Ptr<AudioPlayerInterface>::Ref audioPlayer,
Ptr<PlayLogInterface>::Ref playLog)
throw ();
/**

View file

@ -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<PlaylistEventContainer>::Ref eventContainer;
Ptr<time_duration>::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)));

View file

@ -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) &gt;
* </code></pre>
*
* @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<AudioPlayerInterface>::Ref audioPlayer;
/**
* The play logging facility.
*/
Ptr<PlayLogInterface>::Ref playLog;
/**
* The addAudioClipToPlaylistMethod the daemon is providing.
*/