diff --git a/livesupport/modules/core/etc/fadeInfo.xml b/livesupport/modules/core/etc/fadeInfo.xml
index f1050556f..c421771ea 100644
--- a/livesupport/modules/core/etc/fadeInfo.xml
+++ b/livesupport/modules/core/etc/fadeInfo.xml
@@ -6,4 +6,4 @@
]>
-
+
diff --git a/livesupport/modules/core/etc/playlist.xml b/livesupport/modules/core/etc/playlist.xml
index 7f27c6ded..7ac21d6ef 100644
--- a/livesupport/modules/core/etc/playlist.xml
+++ b/livesupport/modules/core/etc/playlist.xml
@@ -23,8 +23,10 @@
-
-
+
diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx
index e1435099d..4ee7df105 100644
--- a/livesupport/modules/core/src/AudioClip.cxx
+++ b/livesupport/modules/core/src/AudioClip.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.13 $
+ Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
------------------------------------------------------------------------------*/
@@ -192,10 +192,7 @@ AudioClip :: configure(const xmlpp::Element & element)
eMsg += idAttrName;
throw std::invalid_argument(eMsg);
}
- std::stringstream idStream(attribute->get_value());
- UniqueId::IdType idValue;
- idStream >> idValue;
- id.reset(new UniqueId(idValue));
+ id.reset(new UniqueId(attribute->get_value()));
}
if (!playlength
diff --git a/livesupport/modules/core/src/AudioClipTest.cxx b/livesupport/modules/core/src/AudioClipTest.cxx
index e700b129b..060bfc9f6 100644
--- a/livesupport/modules/core/src/AudioClipTest.cxx
+++ b/livesupport/modules/core/src/AudioClipTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -102,7 +102,7 @@ AudioClipTest :: firstTest(void)
audioClip->configure(*root);
- CPPUNIT_ASSERT(audioClip->getId()->getId() == 1);
+ CPPUNIT_ASSERT(audioClip->getId()->getId() == 0x1);
Ptr::Ref duration
= audioClip->getPlaylength();
CPPUNIT_ASSERT(duration->hours() == 0);
diff --git a/livesupport/modules/core/src/FadeInfo.cxx b/livesupport/modules/core/src/FadeInfo.cxx
index ad05940fa..e51ecded5 100644
--- a/livesupport/modules/core/src/FadeInfo.cxx
+++ b/livesupport/modules/core/src/FadeInfo.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.3 $
+ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfo.cxx,v $
------------------------------------------------------------------------------*/
@@ -92,10 +92,7 @@ FadeInfo :: configure(const xmlpp::Element & element)
eMsg += idAttrName;
throw std::invalid_argument(eMsg);
}
- std::stringstream idStream(attribute->get_value());
- UniqueId::IdType idValue;
- idStream >> idValue;
- id.reset(new UniqueId(idValue));
+ id.reset(new UniqueId(attribute->get_value()));
if (!(attribute = element.get_attribute(fadeInAttrName))) {
std::string eMsg = "missing attribute ";
diff --git a/livesupport/modules/core/src/FadeInfoTest.cxx b/livesupport/modules/core/src/FadeInfoTest.cxx
index e454c32d2..c6098d6da 100644
--- a/livesupport/modules/core/src/FadeInfoTest.cxx
+++ b/livesupport/modules/core/src/FadeInfoTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.2 $
+ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfoTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -102,7 +102,7 @@ FadeInfoTest :: firstTest(void)
fadeInfo->configure(*root);
- CPPUNIT_ASSERT(fadeInfo->getId()->getId() == 9901);
+ CPPUNIT_ASSERT(fadeInfo->getId()->getId() == 0x9901);
Ptr::Ref
fadeIn = fadeInfo->getFadeIn();
@@ -118,7 +118,7 @@ FadeInfoTest :: firstTest(void)
CPPUNIT_ASSERT(fadeOut->fractional_seconds() == 500);
CPPUNIT_ASSERT(*fadeInfo->getXmlString() ==
- "");
diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx
index ef6c4d418..0851949e5 100644
--- a/livesupport/modules/core/src/Playlist.cxx
+++ b/livesupport/modules/core/src/Playlist.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.20 $
+ Version : $Revision: 1.21 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
------------------------------------------------------------------------------*/
@@ -92,10 +92,7 @@ Playlist :: configure(const xmlpp::Element & element)
eMsg += idAttrName;
throw std::invalid_argument(eMsg);
}
- std::stringstream idStream(attribute->get_value());
- UniqueId::IdType idValue;
- idStream >> idValue;
- id.reset(new UniqueId(idValue));
+ id.reset(new UniqueId(attribute->get_value()));
if (!(attribute = element.get_attribute(playlengthAttrName))) {
std::string eMsg = "missing attribute ";
diff --git a/livesupport/modules/core/src/PlaylistElement.cxx b/livesupport/modules/core/src/PlaylistElement.cxx
index 4ddb9918a..47a64c0e9 100644
--- a/livesupport/modules/core/src/PlaylistElement.cxx
+++ b/livesupport/modules/core/src/PlaylistElement.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.8 $
+ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $
------------------------------------------------------------------------------*/
@@ -104,10 +104,7 @@ PlaylistElement :: configure(const xmlpp::Element & element)
eMsg += idAttrName;
throw std::invalid_argument(eMsg);
}
- std::stringstream idStream(attribute->get_value());
- UniqueId::IdType idValue;
- idStream >> idValue;
- id.reset(new UniqueId(idValue));
+ id.reset(new UniqueId(attribute->get_value()));
// set relative offset
if (!(attribute = element.get_attribute(relativeOffsetAttrName))) {
diff --git a/livesupport/modules/core/src/PlaylistElementTest.cxx b/livesupport/modules/core/src/PlaylistElementTest.cxx
index 5a4a03ee4..f68debf41 100644
--- a/livesupport/modules/core/src/PlaylistElementTest.cxx
+++ b/livesupport/modules/core/src/PlaylistElementTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElementTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -106,13 +106,13 @@ PlaylistElementTest :: firstTest(void)
playlistElement->configure(*root);
// the playlist element
- CPPUNIT_ASSERT(playlistElement->getId()->getId() == 103);
+ CPPUNIT_ASSERT(playlistElement->getId()->getId() == 0x103);
Ptr::Ref relativeOffset
= playlistElement->getRelativeOffset();
CPPUNIT_ASSERT(relativeOffset->total_seconds() == 11);
CPPUNIT_ASSERT(playlistElement->getFadeInfo()->getId()->getId()
- == 9901);
+ == 0x9901);
Ptr::Ref fadeIn
= playlistElement->getFadeInfo()
->getFadeIn();
@@ -132,7 +132,7 @@ PlaylistElementTest :: firstTest(void)
// the playlist inside the playlist element
CPPUNIT_ASSERT(playlistElement->getPlaylist()->getId()->getId()
- == 2);
+ == 0x2);
Ptr::Ref playlist = playlistElement->getPlaylist();
Playlist::const_iterator it = playlist->begin();
CPPUNIT_ASSERT(it != playlist->end());
@@ -141,7 +141,7 @@ PlaylistElementTest :: firstTest(void)
CPPUNIT_ASSERT(it == playlist->end());
// the playlist element inside the playlist
- CPPUNIT_ASSERT(playlistElement->getId()->getId() == 111);
+ CPPUNIT_ASSERT(playlistElement->getId()->getId() == 0x111);
relativeOffset = playlistElement->getRelativeOffset();
CPPUNIT_ASSERT(relativeOffset->total_seconds() == 0);
@@ -149,16 +149,16 @@ PlaylistElementTest :: firstTest(void)
== PlaylistElement::AudioClipType);
CPPUNIT_ASSERT(*playlistElement->getXmlString() ==
- "\n"
- "\n"
"");
// and the audio clip inside the playlist element
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
- == 10003);
+ == 0x10003);
// check that we can access this audio clip as a Playable instance
CPPUNIT_ASSERT(playlistElement->getAudioClip()
diff --git a/livesupport/modules/core/src/PlaylistTest.cxx b/livesupport/modules/core/src/PlaylistTest.cxx
index cd9d8d692..b87f3d6d8 100644
--- a/livesupport/modules/core/src/PlaylistTest.cxx
+++ b/livesupport/modules/core/src/PlaylistTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.15 $
+ Version : $Revision: 1.16 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -108,7 +108,7 @@ void
PlaylistTest :: firstTest(void)
throw (CPPUNIT_NS::Exception)
{
- CPPUNIT_ASSERT(playlist->getId()->getId() == 1);
+ CPPUNIT_ASSERT(playlist->getId()->getId() == 0x1);
Ptr::Ref duration
= playlist->getPlaylength();
CPPUNIT_ASSERT(duration->total_seconds() == 34);
@@ -117,18 +117,18 @@ PlaylistTest :: firstTest(void)
CPPUNIT_ASSERT(*playlist->getXmlString() ==
"\n"
-"\n"
-"\n"
+"\n"
+"\n"
"\n"
-"\n"
-"\n"
-"\n"
+"\n"
+"\n"
"\n"
-"\n"
+"\n"
"\n"
-"\n"
-"\n"
+"\n"
+"\n"
"\n"
"\n"
"\n"
@@ -137,25 +137,25 @@ PlaylistTest :: firstTest(void)
Playlist::const_iterator it = playlist->begin();
CPPUNIT_ASSERT(it != playlist->end());
Ptr::Ref playlistElement = it->second;
- CPPUNIT_ASSERT(playlistElement->getId()->getId() == 101);
+ CPPUNIT_ASSERT(playlistElement->getId()->getId() == 0x101);
Ptr::Ref relativeOffset
= playlistElement->getRelativeOffset();
CPPUNIT_ASSERT(relativeOffset->total_seconds() == 0);
CPPUNIT_ASSERT(playlistElement->getType()
== PlaylistElement::AudioClipType);
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
- == 10001);
+ == 0x10001);
++it;
CPPUNIT_ASSERT(it != playlist->end());
playlistElement = it->second;
- CPPUNIT_ASSERT(playlistElement->getId()->getId() == 102);
+ CPPUNIT_ASSERT(playlistElement->getId()->getId() == 0x102);
relativeOffset = playlistElement->getRelativeOffset();
CPPUNIT_ASSERT(relativeOffset->total_seconds() == 11);
CPPUNIT_ASSERT(playlistElement->getType()
== PlaylistElement::AudioClipType);
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
- == 10002);
+ == 0x10002);
++it;
// CPPUNIT_ASSERT(it == playlist->end());
@@ -198,7 +198,7 @@ void
PlaylistTest :: audioClipTest(void)
throw (CPPUNIT_NS::Exception)
{
- Ptr::Ref clipId(new UniqueId(20001));
+ Ptr::Ref clipId(new UniqueId("20001"));
Ptr::Ref clipLength(new time_duration(0,30,0,0));
Ptr::Ref audioClip(new AudioClip(clipId, clipLength));
@@ -229,7 +229,7 @@ PlaylistTest :: audioClipTest(void)
CPPUNIT_ASSERT(playlistElement->getType()
== PlaylistElement::AudioClipType);
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
- == 20001);
+ == 0x20001);
Ptr::Ref otherRelativeOffset
= playlistElement->getRelativeOffset();
@@ -306,7 +306,7 @@ PlaylistTest :: savedCopyTest(void)
CPPUNIT_ASSERT(playlistElement->getType()
== PlaylistElement::AudioClipType);
CPPUNIT_ASSERT(playlistElement->getAudioClip()->getId()->getId()
- == 10002);
+ == 0x10002);
++it;
CPPUNIT_ASSERT(it != playlist->end());
++it;
diff --git a/livesupport/modules/storage/etc/testStorage.xml b/livesupport/modules/storage/etc/testStorage.xml
index c6c415719..a48f82c11 100644
--- a/livesupport/modules/storage/etc/testStorage.xml
+++ b/livesupport/modules/storage/etc/testStorage.xml
@@ -24,43 +24,47 @@
]>
-
-
-
+
+
-
-
+
-
-
-
-
-
+
+
+
-
-
-
+
+
-
-
-
diff --git a/livesupport/modules/storage/src/TestStorageClient.cxx b/livesupport/modules/storage/src/TestStorageClient.cxx
index 57b8ee84b..621eedd23 100644
--- a/livesupport/modules/storage/src/TestStorageClient.cxx
+++ b/livesupport/modules/storage/src/TestStorageClient.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.22 $
+ Version : $Revision: 1.23 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@@ -257,7 +257,7 @@ TestStorageClient :: acquirePlaylist(Ptr::Ref sessionId,
PlaylistMap::const_iterator playlistMapIt = playlistMap.find(id->getId());
if (playlistMapIt == playlistMap.end()) {
- throw StorageException("no such playlist");
+ throw Storage::InvalidArgumentException("no such playlist");
}
Ptr::Ref oldPlaylist = playlistMapIt->second;
@@ -317,14 +317,15 @@ TestStorageClient :: acquirePlaylist(Ptr::Ref sessionId,
++it;
}
else { // this should never happen
- Ptr::Ref nullPointer;
- return nullPointer;
+ throw Storage::InvalidArgumentException(
+ "unexpected playlist element type "
+ "(neither audio clip nor playlist)");
}
}
std::stringstream fileName;
- fileName << localTempStorage << newPlaylist->getId()->getId()
+ fileName << localTempStorage << std::string(*newPlaylist->getId())
<< "-" << std::rand() << ".smil";
smilDocument->write_to_file(fileName.str(), "UTF-8");
@@ -344,20 +345,20 @@ TestStorageClient :: releasePlaylist(Ptr::Ref sessionId,
throw (StorageException)
{
if (! playlist->getUri()) {
- throw StorageException("playlist URI not found");
+ throw Storage::InvalidArgumentException("playlist URI not found");
}
-
+
std::ifstream ifs(playlist->getUri()->substr(7).c_str());
- if (!ifs) {
+ if (!ifs) { // cut of "file://"
ifs.close();
- throw StorageException("playlist temp file not found");
+ throw Storage::IOException("playlist temp file not found");
}
ifs.close();
std::remove(playlist->getUri()->substr(7).c_str());
- int badPlaylistElements = 0;
- Playlist::const_iterator it = playlist->begin();
+ std::string eMsg = "";
+ Playlist::const_iterator it = playlist->begin();
while (it != playlist->end()) {
Ptr::Ref plElement = it->second;
if (plElement->getType() == PlaylistElement::AudioClipType) {
@@ -365,7 +366,8 @@ TestStorageClient :: releasePlaylist(Ptr::Ref sessionId,
releaseAudioClip(sessionId, it->second->getAudioClip());
}
catch (StorageException &e) {
- ++badPlaylistElements;
+ eMsg += e.what();
+ eMsg += "\n";
}
++it;
}
@@ -374,23 +376,22 @@ TestStorageClient :: releasePlaylist(Ptr::Ref sessionId,
releasePlaylist(sessionId, it->second->getPlaylist());
}
catch (StorageException &e) {
- ++badPlaylistElements;
+ eMsg += e.what();
+ eMsg += "\n";
}
++it;
}
else { // this should never happen
- ++badPlaylistElements;
+ eMsg += "unexpected playlist element type\n";
}
}
Ptr::Ref nullPointer;
playlist->setUri(nullPointer);
- if (badPlaylistElements) {
- std::stringstream eMsg;
- eMsg << "could not release " << badPlaylistElements
- << " playlist elements in playlist";
- throw StorageException(eMsg.str());
+ if (eMsg != "") {
+ eMsg.insert(0, "some playlist elements could not be released:\n");
+ throw Storage::InvalidArgumentException(eMsg);
}
}
diff --git a/livesupport/modules/storage/src/TestStorageClientTest.cxx b/livesupport/modules/storage/src/TestStorageClientTest.cxx
index f6c34d580..5de1eeb75 100644
--- a/livesupport/modules/storage/src/TestStorageClientTest.cxx
+++ b/livesupport/modules/storage/src/TestStorageClientTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.17 $
+ Version : $Revision: 1.18 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -129,8 +129,8 @@ void
TestStorageClientTest :: deletePlaylistTest(void)
throw (CPPUNIT_NS::Exception)
{
- Ptr::Ref id1(new UniqueId(1));
- Ptr::Ref id2(new UniqueId(77));
+ Ptr::Ref id1(new UniqueId(0x1));
+ Ptr::Ref id2(new UniqueId(0x77));
try {
tsc->deletePlaylist(dummySessionId, id2);
@@ -162,7 +162,7 @@ TestStorageClientTest :: getAllPlaylistsTest(void)
CPPUNIT_ASSERT(playlistVector->size() == 2);
Ptr::Ref playlist = (*playlistVector)[0];
- CPPUNIT_ASSERT((int) (playlist->getId()->getId()) == 1);
+ CPPUNIT_ASSERT((int) (playlist->getId()->getId()) == 0x1);
}
@@ -186,8 +186,8 @@ void
TestStorageClientTest :: audioClipTest(void)
throw (CPPUNIT_NS::Exception)
{
- Ptr::Ref id02(new UniqueId(10002));
- Ptr::Ref id77(new UniqueId(10077));
+ Ptr::Ref id02(new UniqueId(0x10002));
+ Ptr::Ref id77(new UniqueId(0x10077));
CPPUNIT_ASSERT(tsc->existsAudioClip(dummySessionId, id02));
CPPUNIT_ASSERT(!tsc->existsAudioClip(dummySessionId, id77));
@@ -203,7 +203,7 @@ TestStorageClientTest :: audioClipTest(void)
CPPUNIT_ASSERT(audioClipVector->size() == 3);
audioClip = (*audioClipVector)[0];
- CPPUNIT_ASSERT((int) (audioClip->getId()->getId()) == 10001);
+ CPPUNIT_ASSERT((int) (audioClip->getId()->getId()) == 0x10001);
tsc->deleteAudioClip(dummySessionId, id02);
CPPUNIT_ASSERT(!tsc->existsAudioClip(dummySessionId, id02));
@@ -220,8 +220,8 @@ void
TestStorageClientTest :: acquireAudioClipTest(void)
throw (CPPUNIT_NS::Exception)
{
- Ptr::Ref id2(new UniqueId(10002));
- Ptr::Ref id77(new UniqueId(10077));
+ Ptr::Ref id2(new UniqueId(0x10002));
+ Ptr::Ref id77(new UniqueId(0x10077));
Ptr::Ref audioClip;
try {
@@ -262,8 +262,8 @@ void
TestStorageClientTest :: acquirePlaylistTest(void)
throw (CPPUNIT_NS::Exception)
{
- Ptr::Ref id1(new UniqueId(1));
- Ptr::Ref id77(new UniqueId(77));
+ Ptr::Ref id1(new UniqueId(0x1));
+ Ptr::Ref id77(new UniqueId(0x77));
Ptr::Ref playlist;
try {
diff --git a/livesupport/modules/storage/src/WebStorageClient.cxx b/livesupport/modules/storage/src/WebStorageClient.cxx
index a9d262759..10ecdeb4d 100644
--- a/livesupport/modules/storage/src/WebStorageClient.cxx
+++ b/livesupport/modules/storage/src/WebStorageClient.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.17 $
+ Version : $Revision: 1.18 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
------------------------------------------------------------------------------*/
@@ -149,6 +149,16 @@ static const std::string smilAudioClipNodeName = "audio";
*----------------------------------------------------------------------------*/
static const std::string smilAudioClipUriAttrName = "src";
+/*------------------------------------------------------------------------------
+ * The name of the sub-playlist element node in the SMIL file.
+ *----------------------------------------------------------------------------*/
+static const std::string smilPlaylistNodeName = "audio";
+
+/*------------------------------------------------------------------------------
+ * The name of the attribute containing the URI of the sub-playlist element.
+ *----------------------------------------------------------------------------*/
+static const std::string smilPlaylistUriAttrName = "src";
+
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: error reports */
@@ -799,6 +809,7 @@ WebStorageClient :: editPlaylist(Ptr::Ref sessionId,
{
Ptr::Ref playlist(new Playlist(id));
Ptr::Ref url, token;
+
editPlaylistGetUrl(sessionId, id, url, token);
try {
@@ -955,8 +966,79 @@ WebStorageClient :: acquirePlaylist(Ptr::Ref sessionId,
Ptr::Ref id) const
throw (StorageException)
{
- Ptr::Ref playlist(new Playlist);
- return playlist;
+ Ptr::Ref oldPlaylist = getPlaylist(sessionId, id);
+
+ Ptr::Ref playlength = oldPlaylist->getPlaylength();
+ Ptr::Ref newPlaylist(new Playlist(UniqueId::generateId(),
+ playlength));
+ Ptr::Ref
+ smilDocument(new xmlpp::Document(xmlVersion));
+ xmlpp::Element * smilRootNode
+ = smilDocument->create_root_node(smilRootNodeName);
+ smilRootNode->set_attribute(smilLanguageAttrName,
+ smilLanguageAttrValue);
+ smilRootNode->set_attribute(smilExtensionsAttrName,
+ smilExtensionsAttrValue);
+
+ xmlpp::Element * smilBodyNode
+ = smilRootNode->add_child(smilBodyNodeName);
+ xmlpp::Element * smilSeqNode
+ = smilBodyNode->add_child(smilSeqNodeName);
+
+ Playlist::const_iterator it = oldPlaylist->begin();
+
+ while (it != oldPlaylist->end()) {
+ Ptr::Ref plElement = it->second;
+ Ptr::Ref fadeInfo = plElement->getFadeInfo();
+
+ if (plElement->getType() == PlaylistElement::AudioClipType) {
+ Ptr::Ref audioClip
+ = acquireAudioClip(sessionId, plElement
+ ->getAudioClip()
+ ->getId());
+ Ptr::Ref relativeOffset
+ = plElement->getRelativeOffset();
+ newPlaylist->addAudioClip(audioClip, relativeOffset, fadeInfo);
+
+ xmlpp::Element* smilAudioClipNode
+ = smilSeqNode->add_child(smilAudioClipNodeName);
+ smilAudioClipNode->set_attribute(
+ smilAudioClipUriAttrName,
+ *(audioClip->getUri()) );
+ ++it;
+ }
+ else if (plElement->getType() == PlaylistElement::PlaylistType) {
+ Ptr::Ref playlist
+ = acquirePlaylist(sessionId, plElement
+ ->getPlaylist()
+ ->getId());
+ Ptr::Ref relativeOffset
+ = plElement->getRelativeOffset();
+ newPlaylist->addPlaylist(playlist, relativeOffset, fadeInfo);
+
+ xmlpp::Element* smilPlaylistNode
+ = smilSeqNode->add_child(smilPlaylistNodeName);
+ smilPlaylistNode->set_attribute(
+ smilPlaylistUriAttrName,
+ *(playlist->getUri()) );
+ ++it;
+ }
+ else { // this should never happen
+ throw Storage::InvalidArgumentException(
+ "unexpected playlist element type "
+ "(neither audio clip nor playlist)");
+ }
+ }
+
+ std::stringstream fileName;
+ fileName << localTempStorage << std::string(*newPlaylist->getId())
+ << "-" << std::rand() << ".smil";
+
+ smilDocument->write_to_file(fileName.str(), "UTF-8");
+
+ Ptr::Ref playlistUri(new std::string(fileName.str()));
+ newPlaylist->setUri(playlistUri);
+ return newPlaylist;
}
@@ -968,7 +1050,55 @@ WebStorageClient :: releasePlaylist(Ptr::Ref sessionId,
Ptr::Ref playlist) const
throw (StorageException)
{
+ if (! playlist->getUri()) {
+ throw Storage::InvalidArgumentException("playlist URI not found");
+ }
+
+ std::ifstream ifs(playlist->getUri()->substr(7).c_str());
+ if (!ifs) { // cut of "file://"
+ ifs.close();
+ throw Storage::IOException("playlist temp file not found");
+ }
+ ifs.close();
+ std::remove(playlist->getUri()->substr(7).c_str());
+
+ std::string eMsg = "";
+ Playlist::const_iterator it = playlist->begin();
+ while (it != playlist->end()) {
+ Ptr::Ref plElement = it->second;
+ if (plElement->getType() == PlaylistElement::AudioClipType) {
+ try {
+ releaseAudioClip(sessionId, it->second->getAudioClip());
+ }
+ catch (StorageException &e) {
+ eMsg += e.what();
+ eMsg += "\n";
+ }
+ ++it;
+ }
+ else if (plElement->getType() == PlaylistElement::PlaylistType) {
+ try {
+ releasePlaylist(sessionId, it->second->getPlaylist());
+ }
+ catch (StorageException &e) {
+ eMsg += e.what();
+ eMsg += "\n";
+ }
+ ++it;
+ }
+ else { // this should never happen
+ eMsg += "unexpected playlist element type\n";
+ }
+ }
+
+ Ptr::Ref nullPointer;
+ playlist->setUri(nullPointer);
+
+ if (eMsg != "") {
+ eMsg.insert(0, "some playlist elements could not be released:\n");
+ throw Storage::InvalidArgumentException(eMsg);
+ }
}
@@ -1094,6 +1224,9 @@ WebStorageClient :: createPlaylist(Ptr::Ref sessionId)
Ptr::Ref newId(new UniqueId(std::string(
result[createPlaylistResultParamName] )));
+// std::cerr << "\nnew id: "
+// << std::string(result[createPlaylistResultParamName]) << "\n";
+
Ptr::Ref url, token;
editPlaylistGetUrl(sessionId, newId, url, token);
@@ -1310,8 +1443,10 @@ WebStorageClient :: storeAudioClip(Ptr::Ref sessionId,
parameters.clear();
parameters[storeAudioClipSessionIdParamName]
= sessionId->getId();
- parameters[storeAudioClipAudioClipIdParamName]
+ if (audioClip->getId()->getId() != 0) { // ID==0 means 'please
+ parameters[storeAudioClipAudioClipIdParamName] // generate new ID'
= std::string(*audioClip->getId());
+ }
parameters[storeAudioClipMetadataParamName]
= std::string(*audioClip->getMetadataString());
parameters[storeAudioClipChecksumParamName]
@@ -1414,8 +1549,10 @@ WebStorageClient :: storeAudioClip(Ptr::Ref sessionId,
if (! result.hasMember(storeAudioClipAudioClipIdParamName)
|| result[storeAudioClipAudioClipIdParamName].getType()
!= XmlRpcValue::TypeString
- || std::string(result[storeAudioClipAudioClipIdParamName])
- != std::string(*audioClip->getId())) {
+ || (audioClip->getId()->getId() != 0
+ &&
+ std::string(result[storeAudioClipAudioClipIdParamName])
+ != std::string(*audioClip->getId()))) {
std::stringstream eMsg;
eMsg << "XML-RPC method '"
<< storeAudioClipCloseMethodName
diff --git a/livesupport/modules/storage/src/WebStorageClient.h b/livesupport/modules/storage/src/WebStorageClient.h
index a94ee0e0c..2a44d49bd 100644
--- a/livesupport/modules/storage/src/WebStorageClient.h
+++ b/livesupport/modules/storage/src/WebStorageClient.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.12 $
+ Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
------------------------------------------------------------------------------*/
@@ -99,7 +99,7 @@ using namespace LiveSupport::Core;
*
*
* @author $Author: fgerlits $
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
class WebStorageClient :
virtual public Configurable,
@@ -363,6 +363,9 @@ class WebStorageClient :
* form file:relative_path/file_name.mp3
. Later this
* should be changed to an absolute URI.
*
+ * The size of the binary file must be less than 2 GB, because the
+ * storage server can not deal with larger files.
+ *
* @param sessionId the session ID from the authentication client
* @param audioClip the audio clip to store.
* @return true if the operation was successful.
diff --git a/livesupport/modules/storage/src/WebStorageClientTest.cxx b/livesupport/modules/storage/src/WebStorageClientTest.cxx
index 27e4aa0bf..46cab8d06 100644
--- a/livesupport/modules/storage/src/WebStorageClientTest.cxx
+++ b/livesupport/modules/storage/src/WebStorageClientTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.19 $
+ Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -185,7 +185,7 @@ WebStorageClientTest :: playlistTest(void)
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
- CPPUNIT_ASSERT(uniqueIdVector->size() > 0);
+ CPPUNIT_ASSERT(uniqueIdVector->size() >= 3);
Ptr::Ref audioClipId = uniqueIdVector->at(0);
Ptr::Ref sessionId;
@@ -258,8 +258,14 @@ WebStorageClientTest :: playlistTest(void)
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
+
Ptr::Ref relativeOffset(new time_duration(0,0,0,0));
playlist->addAudioClip(audioClip, relativeOffset);
+ relativeOffset.reset(new time_duration(0,0,3,0));
+ playlist->addAudioClip(audioClip, relativeOffset);
+ relativeOffset.reset(new time_duration(0,0,6,0));
+ playlist->addAudioClip(audioClip, relativeOffset);
+
CPPUNIT_ASSERT(playlist->valid()); // WARNING: side effect; fixes the
// playlength of the playlist
try {
@@ -280,6 +286,7 @@ WebStorageClientTest :: playlistTest(void)
CPPUNIT_FAIL(e.what());
}
+
// test getPlaylist()
Ptr::Ref newPlaylist;
try {
@@ -293,6 +300,42 @@ WebStorageClientTest :: playlistTest(void)
== playlist->getPlaylength()->total_seconds());
// NOTE: we really ought to define == for playlists...
+
+ // test acquirePlaylist() and releasePlaylist()
+ try {
+ newPlaylist = wsc->acquirePlaylist(sessionId, playlistIdxx);
+ }
+ catch (StorageException &e) {
+ CPPUNIT_FAIL(e.what());
+ }
+ CPPUNIT_ASSERT(newPlaylist);
+ CPPUNIT_ASSERT(newPlaylist->getUri());
+//std::cerr << "url:\n" << *newPlaylist->getUri() << "\n";
+
+ std::ifstream ifs(newPlaylist->getUri()->substr(7).c_str());
+ if (!ifs) { // cut off "file://"
+ ifs.close();
+ CPPUNIT_FAIL("playlist temp file not found");
+ }
+// std::stringstream playlistSmilFile;
+// std::string tempString;
+// while (ifs) {
+// std::getline(ifs, tempString);
+// playlistSmilFile << tempString << "\n";
+// }
+//std::cerr << "smil:\n" << playlistSmilFile.str() << "\n";
+//sleep(60);
+ ifs.close();
+
+ try {
+ wsc->releasePlaylist(sessionId, newPlaylist);
+ }
+ catch (StorageException &e) {
+ CPPUNIT_FAIL(e.what());
+ }
+ CPPUNIT_ASSERT(!newPlaylist->getUri());
+
+
// test deletePlaylist()
try {
wsc->deletePlaylist(sessionId, playlistIdxx);
@@ -325,13 +368,13 @@ WebStorageClientTest :: audioClipTest(void)
catch (StorageException &e) {
CPPUNIT_FAIL(e.what());
}
- CPPUNIT_ASSERT(uniqueIdVector->size() > 0);
- Ptr::Ref id01 = uniqueIdVector->at(0);
+ CPPUNIT_ASSERT(uniqueIdVector->size() >= 2);
+ Ptr::Ref id01 = uniqueIdVector->at(1);
-/* std::cout << "\nReset storage result:\n";
- for (unsigned i=0; isize(); i++) {
- std::cout << std::hex << std::string(*uniqueIdVector->at(i)) << std::endl;
- } */
+// std::cout << "\nReset storage result:\n";
+// for (unsigned i=0; isize(); i++) {
+// std::cout << std::hex << std::string(*uniqueIdVector->at(i)) << std::endl;
+// }
Ptr::Ref sessionId;
try {
diff --git a/livesupport/products/scheduler/etc/playlist.xml b/livesupport/products/scheduler/etc/playlist.xml
index 10b060141..7a4a3ef41 100644
--- a/livesupport/products/scheduler/etc/playlist.xml
+++ b/livesupport/products/scheduler/etc/playlist.xml
@@ -21,17 +21,17 @@
]>
-
-
-
+
+
-
-
+
-
+
diff --git a/livesupport/products/scheduler/etc/scheduler.xml b/livesupport/products/scheduler/etc/scheduler.xml
index 4df297026..6b7325ed3 100644
--- a/livesupport/products/scheduler/etc/scheduler.xml
+++ b/livesupport/products/scheduler/etc/scheduler.xml
@@ -63,22 +63,25 @@
-
-
-
+
+
-
-
+
-
-
diff --git a/livesupport/products/scheduler/etc/storageClient.xml b/livesupport/products/scheduler/etc/storageClient.xml
index b2f02629c..9ad61269a 100644
--- a/livesupport/products/scheduler/etc/storageClient.xml
+++ b/livesupport/products/scheduler/etc/storageClient.xml
@@ -27,22 +27,23 @@
]>
-
-
-
+
+
-
-
+
-
-
diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx
index f2ddc296f..e0bf32bfc 100644
--- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx
+++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.8 $
+ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -179,7 +179,7 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
parameters.clear();
parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1;
- parameters["audioClipId"] = 10001;
+ parameters["audioClipId"] = 0x10001;
parameters["relativeOffset"] = 60*60;
rootParameter[0] = parameters;
@@ -206,7 +206,7 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void)
parameters.clear();
parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1;
- parameters["audioClipId"] = 10001;
+ parameters["audioClipId"] = 0x10001;
parameters["relativeOffset"] = 90*60;
rootParameter[0] = parameters;
diff --git a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx
index 0107a94f8..a223aee64 100644
--- a/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx
+++ b/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.5 $
+ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -173,7 +173,7 @@ DisplayAudioClipMethodTest :: firstTest(void)
// set up a structure for the parameter
parameter["sessionId"] = sessionId->getId();
- parameter["audioClipId"] = 10001;
+ parameter["audioClipId"] = 0x10001;
rootParameter[0] = parameter;
result.clear();
@@ -186,7 +186,7 @@ DisplayAudioClipMethodTest :: firstTest(void)
<< " - " << e.getMessage();
CPPUNIT_FAIL(eMsg.str());
}
- CPPUNIT_ASSERT(int(result["id"]) == 10001);
+ CPPUNIT_ASSERT(int(result["id"]) == 0x10001);
CPPUNIT_ASSERT(int(result["playlength"]) == (60 * 60));
}
@@ -206,7 +206,7 @@ DisplayAudioClipMethodTest :: negativeTest(void)
// set up a structure for the parameter
parameter["sessionId"] = sessionId->getId();
- parameter["audioClipId"] = 9999;
+ parameter["audioClipId"] = 0x9999;
rootParameter[0] = parameter;
result.clear();
diff --git a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx
index 49696bc9a..09ceb56ac 100644
--- a/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx
+++ b/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.5 $
+ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayAudioClipsMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -188,11 +188,11 @@ DisplayAudioClipsMethodTest :: firstTest(void)
CPPUNIT_ASSERT(result.size() == 2);
audioClip = result[0];
- CPPUNIT_ASSERT(int(audioClip["id"]) == 10001);
+ CPPUNIT_ASSERT(int(audioClip["id"]) == 0x10001);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 60 * 60);
audioClip = result[1];
- CPPUNIT_ASSERT(int(audioClip["id"]) == 10002);
+ CPPUNIT_ASSERT(int(audioClip["id"]) == 0x10002);
CPPUNIT_ASSERT(int(audioClip["playlength"]) == 30 * 60);
}
diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx
index 9e9eb486a..0befde1c2 100644
--- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx
+++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -184,7 +184,7 @@ RemoveAudioClipFromPlaylistMethodTest :: firstTest(void)
parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1;
- parameters["audioClipId"] = 10001;
+ parameters["audioClipId"] = 0x10001;
parameters["relativeOffset"] = 90*60;
rootParameter[0] = parameters;
diff --git a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx
index 3639ba373..7ee881d21 100644
--- a/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx
+++ b/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.3 $
+ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RpcAddAudioClipToPlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -195,7 +195,7 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1;
- parameters["audioClipId"] = 10001;
+ parameters["audioClipId"] = 0x10001;
parameters["relativeOffset"] = 0;
result.clear();
@@ -211,7 +211,7 @@ RpcAddAudioClipToPlaylistTest :: firstTest(void)
parameters.clear();
parameters["sessionId"] = sessionId->getId();
parameters["playlistId"] = 1;
- parameters["audioClipId"] = 10001;
+ parameters["audioClipId"] = 0x10001;
parameters["relativeOffset"] = 90*60;
result.clear();
diff --git a/livesupport/products/scheduler/src/XmlRpcToolsTest.cxx b/livesupport/products/scheduler/src/XmlRpcToolsTest.cxx
index 7f3f38f82..4032bc2a3 100644
--- a/livesupport/products/scheduler/src/XmlRpcToolsTest.cxx
+++ b/livesupport/products/scheduler/src/XmlRpcToolsTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.4 $
+ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcToolsTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -140,7 +140,7 @@ XmlRpcToolsTest :: firstTest(void)
CPPUNIT_ASSERT(int(xmlRpcPlaylist["id"]) == 1);
CPPUNIT_ASSERT(int(xmlRpcPlaylist["playlength"]) == 90 * 60);
- CPPUNIT_ASSERT(int(xmlRpcAudioClip["id"]) == 10001);
+ CPPUNIT_ASSERT(int(xmlRpcAudioClip["id"]) == 0x10001);
CPPUNIT_ASSERT(int(xmlRpcAudioClip["playlength"]) == 60 * 60);
XmlRpcValue xmlRpcPlaylistId;