updated code to reflect changes in the storage interface

This commit is contained in:
maroy 2004-11-09 21:38:24 +00:00
parent 3ed2496b03
commit accb53809b
5 changed files with 30 additions and 18 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -79,7 +79,7 @@ PlaylistEvent :: PlaylistEvent(
void void
PlaylistEvent :: initialize(void) throw (std::exception) PlaylistEvent :: initialize(void) throw (std::exception)
{ {
playlistUrl = storage->acquirePlaylist(scheduleEntry->getPlaylistId()); playlist = storage->acquirePlaylist(scheduleEntry->getPlaylistId());
} }
@ -89,8 +89,8 @@ PlaylistEvent :: initialize(void) throw (std::exception)
void void
PlaylistEvent :: deInitialize(void) throw () PlaylistEvent :: deInitialize(void) throw ()
{ {
storage->releasePlaylist(scheduleEntry->getPlaylistId()); storage->releasePlaylist(playlist);
playlistUrl.reset(); playlist.reset();
} }
@ -100,8 +100,12 @@ PlaylistEvent :: deInitialize(void) throw ()
void void
PlaylistEvent :: start(void) throw () PlaylistEvent :: start(void) throw ()
{ {
audioPlayer->playThis(*playlistUrl); try {
audioPlayer->start(); audioPlayer->playThis(*playlist->getUri());
audioPlayer->start();
} catch (std::invalid_argument &e) {
// TODO: handle error?
}
} }

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -69,7 +69,7 @@ using namespace LiveSupport::Scheduler;
* A scheduled event for playing a playlist. * A scheduled event for playing a playlist.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class PlaylistEvent : public virtual ScheduledEventInterface class PlaylistEvent : public virtual ScheduledEventInterface
{ {
@ -95,9 +95,9 @@ class PlaylistEvent : public virtual ScheduledEventInterface
Ptr<time_duration>::Ref initTime; Ptr<time_duration>::Ref initTime;
/** /**
* The URL for this playlist file. * The Playlist this event is playing.
*/ */
Ptr<std::string>::Ref playlistUrl; Ptr<Playlist>::Ref playlist;
public: public:

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEventTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -180,8 +180,12 @@ PlaylistEventTest :: initializeTest(void)
{ {
Ptr<PlaylistEvent>::Ref playlistEvent = createTestEvent(); Ptr<PlaylistEvent>::Ref playlistEvent = createTestEvent();
playlistEvent->initialize(); try {
playlistEvent->deInitialize(); playlistEvent->initialize();
playlistEvent->deInitialize();
} catch (std::logic_error &e) {
CPPUNIT_FAIL(e.what());
}
} }
@ -194,10 +198,14 @@ PlaylistEventTest :: playTest(void)
{ {
Ptr<PlaylistEvent>::Ref playlistEvent = createTestEvent(); Ptr<PlaylistEvent>::Ref playlistEvent = createTestEvent();
playlistEvent->initialize(); try {
playlistEvent->start(); playlistEvent->initialize();
TimeConversion::sleep(duration); playlistEvent->start();
playlistEvent->stop(); TimeConversion::sleep(duration);
playlistEvent->deInitialize(); playlistEvent->stop();
playlistEvent->deInitialize();
} catch (std::logic_error &e) {
CPPUNIT_FAIL(e.what());
}
} }

Binary file not shown.

Binary file not shown.