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 $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/PlaylistEvent.cxx,v $
------------------------------------------------------------------------------*/
@ -79,7 +79,7 @@ PlaylistEvent :: PlaylistEvent(
void
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
PlaylistEvent :: deInitialize(void) throw ()
{
storage->releasePlaylist(scheduleEntry->getPlaylistId());
playlistUrl.reset();
storage->releasePlaylist(playlist);
playlist.reset();
}
@ -100,8 +100,12 @@ PlaylistEvent :: deInitialize(void) throw ()
void
PlaylistEvent :: start(void) throw ()
{
audioPlayer->playThis(*playlistUrl);
audioPlayer->start();
try {
audioPlayer->playThis(*playlist->getUri());
audioPlayer->start();
} catch (std::invalid_argument &e) {
// TODO: handle error?
}
}

View File

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -69,7 +69,7 @@ using namespace LiveSupport::Scheduler;
* A scheduled event for playing a playlist.
*
* @author $Author: maroy $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class PlaylistEvent : public virtual ScheduledEventInterface
{
@ -95,9 +95,9 @@ class PlaylistEvent : public virtual ScheduledEventInterface
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:

View File

@ -22,7 +22,7 @@
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 $
------------------------------------------------------------------------------*/
@ -180,8 +180,12 @@ PlaylistEventTest :: initializeTest(void)
{
Ptr<PlaylistEvent>::Ref playlistEvent = createTestEvent();
playlistEvent->initialize();
playlistEvent->deInitialize();
try {
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();
playlistEvent->initialize();
playlistEvent->start();
TimeConversion::sleep(duration);
playlistEvent->stop();
playlistEvent->deInitialize();
try {
playlistEvent->initialize();
playlistEvent->start();
TimeConversion::sleep(duration);
playlistEvent->stop();
playlistEvent->deInitialize();
} catch (std::logic_error &e) {
CPPUNIT_FAIL(e.what());
}
}

Binary file not shown.

Binary file not shown.