From 11f46d11baf6b19a1ae4d70df2dd0bf0ebe59180 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 29 Dec 2004 10:02:29 +0000 Subject: [PATCH] wrote configuration of AudioClip from metafile; added toXml() method to AudioClip --- livesupport/modules/core/etc/audioClip.xml | 3 +- livesupport/modules/core/etc/playlist.xml | 26 +- .../modules/core/etc/playlistElement.xml | 18 +- .../core/include/LiveSupport/Core/AudioClip.h | 84 +++--- .../core/include/LiveSupport/Core/Playable.h | 24 +- .../core/include/LiveSupport/Core/Playlist.h | 35 ++- livesupport/modules/core/src/AudioClip.cxx | 281 ++++++++++++++---- .../modules/core/src/AudioClipTest.cxx | 20 +- livesupport/modules/core/src/FadeInfo.cxx | 9 +- livesupport/modules/core/src/Playlist.cxx | 24 +- .../modules/core/src/PlaylistElement.cxx | 11 +- livesupport/modules/storage/etc/Makefile.in | 10 +- .../modules/storage/src/WebStorageClient.cxx | 3 +- .../storage/src/WebStorageClientTest.cxx | 9 +- .../storageServer/var/tests/mdata1.xml | 2 +- .../storageServer/var/tests/mdata2.xml | 4 +- .../products/scheduler/etc/Makefile.in | 10 +- 17 files changed, 377 insertions(+), 196 deletions(-) diff --git a/livesupport/modules/core/etc/audioClip.xml b/livesupport/modules/core/etc/audioClip.xml index 6d3eca688..926606eb3 100644 --- a/livesupport/modules/core/etc/audioClip.xml +++ b/livesupport/modules/core/etc/audioClip.xml @@ -1,5 +1,6 @@ - + ]> - + - - + - + - - - - + + + diff --git a/livesupport/modules/core/etc/playlistElement.xml b/livesupport/modules/core/etc/playlistElement.xml index 73023d808..2dd075900 100644 --- a/livesupport/modules/core/etc/playlistElement.xml +++ b/livesupport/modules/core/etc/playlistElement.xml @@ -20,12 +20,18 @@ ]> - - - - + + + + - + diff --git a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h index 6ff194172..009a4d02a 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h +++ b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.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/core/include/LiveSupport/Core/AudioClip.h,v $ ------------------------------------------------------------------------------*/ @@ -100,7 +100,15 @@ using namespace boost::posix_time; * playlength attribute and the * <dcterms:extent> * element are present, then the playlength is set from the attribute and - * <dcterms:extent> is ignored. + * <dcterms:extent> is ignored. Embedded XML elements are + * currently ignored: e.g.,
  <group>
+ *      <member1>value1</member1>
+ *      <member2>value2</member2>
+ *  </group>
produces a single metadata field + * group + * with an empty value, + * and ignores member1 and member2. + * TODO: fix this? * * The URI is not normally part of the XML element; it's only included * as an optional attribute for testing purposes. @@ -116,7 +124,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ */ class AudioClip : public Configurable, public Playable @@ -135,7 +143,7 @@ class AudioClip : public Configurable, /** * The title of the audio clip. */ - Ptr::Ref title; + Ptr::Ref title; /** * The playling length of the audio clip. @@ -145,23 +153,17 @@ class AudioClip : public Configurable, /** * The location of the binary audio clip sound file. */ - Ptr::Ref uri; + Ptr::Ref uri; /** * The identifying token returned by the storage server. */ - Ptr::Ref token; + Ptr::Ref token; /** - * The type for storing the metadata. + * This audio clip in XML format. */ - typedef std::map::Ref> - metadataType; - - /** - * The metadata for this audio clip. - */ - metadataType metadata; + Ptr::Ref xmlAudioClip; public: @@ -197,13 +199,7 @@ class AudioClip : public Configurable, AudioClip(Ptr::Ref id, Ptr::Ref playlength, Ptr::Ref uri = Ptr::Ref()) - throw () - { - this->id = id; - this->title.reset(new UnicodeString("")); - this->playlength = playlength; - this->uri = uri; - } + throw (); /** * Create an audio clip by specifying all details. @@ -215,16 +211,10 @@ class AudioClip : public Configurable, * this audio clip object (optional) */ AudioClip(Ptr::Ref id, - Ptr::Ref title, + Ptr::Ref title, Ptr::Ref playlength, Ptr::Ref uri = Ptr::Ref()) - throw () - { - this->id = id; - this->title = title; - this->playlength = playlength; - this->uri = uri; - } + throw (); /** * A virtual destructor, as this class has virtual functions. @@ -287,7 +277,7 @@ class AudioClip : public Configurable, * * @return the URI. */ - virtual Ptr::Ref + virtual Ptr::Ref getUri(void) const throw () { return uri; @@ -300,7 +290,7 @@ class AudioClip : public Configurable, * @param uri the new URI. */ virtual void - setUri(Ptr::Ref uri) throw () + setUri(Ptr::Ref uri) throw () { this->uri = uri; } @@ -311,7 +301,7 @@ class AudioClip : public Configurable, * * @return the token. */ - virtual Ptr::Ref + virtual Ptr::Ref getToken(void) const throw () { return token; @@ -324,7 +314,8 @@ class AudioClip : public Configurable, * @param token a new token. */ virtual void - setToken(Ptr::Ref token) throw () + setToken(Ptr::Ref token) + throw () { this->token = token; } @@ -335,7 +326,7 @@ class AudioClip : public Configurable, * * @return the title. */ - virtual Ptr::Ref + virtual Ptr::Ref getTitle(void) const throw () { return title; @@ -347,31 +338,31 @@ class AudioClip : public Configurable, * @param title a new title. */ virtual void - setTitle(Ptr::Ref title) - throw () - { - this->title = title; - } - + setTitle(Ptr::Ref title) + throw (); /** * Return the value of a metadata field in this audio clip. * + * @param key the name of the metadata field + * @param ns the namespace of the metadata field (optional) * @return the value of the metadata field; 0 if there is * no such field; */ - virtual Ptr::Ref - getMetadata(const string &key) const + virtual Ptr::Ref + getMetadata(const std::string &key, const std::string &ns = "") const throw (); /** * Set the value of a metadata field in this audio clip. * - * @param key the name of the metadata field. * @param value the new value of the metadata field. + * @param key the name of the metadata field + * @param ns the namespace of the metadata field (optional) */ virtual void - setMetadata(const string &key, Ptr::Ref value) + setMetadata(Ptr::Ref value, const std::string &key, + const std::string &ns = "") throw (); @@ -383,7 +374,10 @@ class AudioClip : public Configurable, * @return an xmlpp::Document containing the metadata. */ Ptr::Ref - toXml() throw (); + toXml() throw () + { + return xmlAudioClip; + } }; diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playable.h b/livesupport/modules/core/include/LiveSupport/Core/Playable.h index a9bd6866f..623932045 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playable.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playable.h @@ -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/include/LiveSupport/Core/Playable.h,v $ ------------------------------------------------------------------------------*/ @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/UniqueId.h" @@ -70,7 +70,7 @@ using namespace boost::posix_time; * It contains the methods which are common to these classes. * * @author $Author: fgerlits $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class Playable { @@ -138,7 +138,7 @@ class Playable * * @return the title. */ - virtual Ptr::Ref + virtual Ptr::Ref getTitle(void) const throw () = 0; /** @@ -147,29 +147,35 @@ class Playable * @param title a new title. */ virtual void - setTitle(Ptr::Ref title) + setTitle(Ptr::Ref title) throw () = 0; /** * Return the value of a metadata field in this audio clip or playlist. * + * @param key the name of the metadata field + * @param ns the namespace of the metadata field (optional) * @return the value of the metadata field; 0 if there is * no such field; */ - virtual Ptr::Ref - getMetadata(const string &key) const + virtual Ptr::Ref + getMetadata(const std::string &key, const std::string &ns = "") const throw () = 0; /** * Set the value of a metadata field in this audio clip or playlist. * - * @param key the name of the metadata field. * @param value the new value of the metadata field. + * @param key the name of the metadata field + * @param ns the namespace of the metadata field (optional) */ virtual void - setMetadata(const string &key, Ptr::Ref value) + setMetadata(Ptr::Ref value, const std::string &key, + const std::string &ns = "") throw () = 0; + + }; diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index eaa91881b..6f15765fc 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -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/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -93,7 +93,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.20 $ + * @version $Revision: 1.21 $ */ class Playlist : public Configurable, public Playable @@ -112,7 +112,7 @@ class Playlist : public Configurable, /** * The title of the playlist. */ - Ptr::Ref title; + Ptr::Ref title; /** * The playling length of the playlist. @@ -171,7 +171,7 @@ class Playlist : public Configurable, /** * The type for storing the metadata. */ - typedef std::map::Ref> + typedef std::map::Ref> metadataType; /** @@ -206,7 +206,7 @@ class Playlist : public Configurable, throw () { this->id = id; - this->title.reset(new UnicodeString("")); + this->title.reset(new Glib::ustring("")); this->playlength = playlength; this->uri = uri; elementList.reset(new PlaylistElementListType); @@ -224,7 +224,7 @@ class Playlist : public Configurable, * playlist (optional) */ Playlist(Ptr::Ref id, - Ptr::Ref title, + Ptr::Ref title, Ptr::Ref playlength, Ptr::Ref uri = Ptr::Ref()) throw () @@ -541,7 +541,7 @@ class Playlist : public Configurable, * * @return the title. */ - virtual Ptr::Ref + virtual Ptr::Ref getTitle(void) const throw () { return title; @@ -553,7 +553,7 @@ class Playlist : public Configurable, * @param title a new title. */ virtual void - setTitle(Ptr::Ref title) + setTitle(Ptr::Ref title) throw () { this->title = title; @@ -563,26 +563,29 @@ class Playlist : public Configurable, /** * Return the value of a metadata field in this playlist. * - * Currently, this always returns a null pointer. - * + * @param key the name of the metadata field + * @param ns the namespace of the metadata field (optional) * @return the value of the metadata field; 0 if there is * no such field; */ - virtual Ptr::Ref - getMetadata(const string &key) const + virtual Ptr::Ref + getMetadata(const std::string &key, const std::string &ns = "") const throw (); /** * Set the value of a metadata field in this playlist. * - * Currently, this does not do anything. - * - * @param key the name of the metadata field. * @param value the new value of the metadata field. + * @param key the name of the metadata field + * @param ns the namespace of the metadata field (optional) */ virtual void - setMetadata(const string &key, Ptr::Ref value) + setMetadata(Ptr::Ref value, const std::string &key, + const std::string &ns = "") throw (); + + + }; diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx index 7df75ff44..b2adc23b5 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.10 $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $ ------------------------------------------------------------------------------*/ @@ -51,21 +51,6 @@ using namespace LiveSupport::Core; *----------------------------------------------------------------------------*/ const std::string AudioClip::configElementNameStr = "audioClip"; -/** - * The name of the metadata child element. - */ -static const std::string metadataElementName = "metadata"; - -/** - * The prefix of the extent (length) metadata element. - */ -static const std::string extentElementPrefix = "dcterms"; - -/** - * The name of the extent (length) metadata element. - */ -static const std::string extentElementName = "extent"; - /** * The name of the attribute to get the id of the audio clip. */ @@ -81,12 +66,104 @@ static const std::string uriAttrName = "uri"; */ static const std::string playlengthAttrName = "playlength"; +/** + * The name of the metadata child element. + */ +static const std::string metadataElementName = "metadata"; + +/** + * The prefix of the extent (length) metadata element. + */ +static const std::string extentElementPrefix = "dcterms"; + +/** + * The URI identifier for the "dcterms" prefix + */ +static const std::string extentElementUri = "http://purl.org/dc/terms/"; + +/** + * The name of the extent (length) metadata element. + */ +static const std::string extentElementName = "extent"; + +/** + * The prefix of the title metadata element. + */ +static const std::string titleElementPrefix = "dc"; + +/** + * The URI identifier for the "dc" prefix + */ +static const std::string titleElementUri ="http://purl.org/dc/elements/1.1/"; + +/** + * The name of the title metadata element. + */ +static const std::string titleElementName = "title"; + +/** + * The URI identifier for the default XML namespace + */ +static const std::string defaultPrefixUri ="http://www.streamonthefly.org/"; + /* =============================================== local function prototypes */ /* ============================================================= module code */ +/*------------------------------------------------------------------------------ + * Test constructor without title. + *----------------------------------------------------------------------------*/ +AudioClip :: AudioClip(Ptr::Ref id, + Ptr::Ref playlength, + Ptr::Ref uri) + throw () +{ + this->id = id; + this->title.reset(new Glib::ustring("")); + this->playlength = playlength; + this->uri = uri; + + Ptr::Ref playlengthString(new Glib::ustring( + to_simple_string(*playlength) )); + setMetadata(playlengthString, extentElementName, extentElementPrefix); +} + +/*------------------------------------------------------------------------------ + * Test constructor with title. + *----------------------------------------------------------------------------*/ +AudioClip :: AudioClip(Ptr::Ref id, + Ptr::Ref title, + Ptr::Ref playlength, + Ptr::Ref uri) + throw () +{ + this->id = id; + this->title = title; + this->playlength = playlength; + this->uri = uri; + + Ptr::Ref playlengthString(new Glib::ustring( + to_simple_string(*playlength) )); + setMetadata(playlengthString, extentElementName, extentElementPrefix); + + setMetadata(title, titleElementName, titleElementPrefix); +} + + +/*------------------------------------------------------------------------------ + * Set the value of the title field. + *----------------------------------------------------------------------------*/ +void +AudioClip :: setTitle(Ptr::Ref title) + throw () +{ + this->title = title; + setMetadata(title, titleElementName, titleElementPrefix); +} + + /*------------------------------------------------------------------------------ * Create an audio clip object based on an XML element. *----------------------------------------------------------------------------*/ @@ -108,9 +185,9 @@ AudioClip :: configure(const xmlpp::Element & element) eMsg += idAttrName; throw std::invalid_argument(eMsg); } - std::stringstream strStr(attribute->get_value()); - UniqueId::IdType idValue; - strStr >> idValue; + std::stringstream idStream(attribute->get_value()); + UniqueId::IdType idValue; + idStream >> idValue; id.reset(new UniqueId(idValue)); } @@ -133,26 +210,43 @@ AudioClip :: configure(const xmlpp::Element & element) const xmlpp::Element * metadataElement = dynamic_cast (*it); - xmlpp::Node::NodeList dataFieldList - = metadataElement->get_children(); - xmlpp::Node::NodeList::iterator listIt = dataFieldList.begin(); + xmlAudioClip.reset(new xmlpp::Document); + xmlpp::Element* root = xmlAudioClip->create_root_node("audioClip"); + root->set_attribute("id", std::string(*id)); + root->import_node(metadataElement, true); // true = recursive + + const xmlpp::Node::NodeList dataFieldList + = metadataElement->get_children(); + xmlpp::Node::NodeList::const_iterator listIt = dataFieldList.begin(); while (listIt != dataFieldList.end()) { - const xmlpp::Node * dataNode = *listIt; - if (!playlength - && dataNode->get_namespace_prefix() == extentElementPrefix - && dataNode->get_name() == extentElementName) { - const xmlpp::Element - * dataElement - = dynamic_cast (dataNode); - if (dataElement->has_child_text()) { - std::stringstream strStr(dataElement->get_child_text() - ->get_content()); - unsigned long int seconds; - strStr >> seconds; - playlength.reset(new time_duration(0,0,seconds,0)); - } + const xmlpp::Node* dataNode = *listIt; + std::string prefix = dataNode->get_namespace_prefix(); + std::string name = dataNode->get_name(); + const xmlpp::Element* + dataElement + = dynamic_cast (dataNode); + if (!dataElement) { + ++listIt; + continue; } + + if (!playlength && prefix == extentElementPrefix + && name == extentElementName + && dataElement->has_child_text()) { + playlength.reset(new time_duration(duration_from_string( + dataElement->get_child_text()->get_content() ))); + } + + if (!title && prefix == titleElementPrefix + && name == titleElementName + && dataElement->has_child_text()) { + Glib::ustring value = dataElement->get_child_text() + ->get_content(); + Ptr::Ref ptrToValue(new Glib::ustring(value)); + title = ptrToValue; + } + ++listIt; } @@ -168,27 +262,54 @@ AudioClip :: configure(const xmlpp::Element & element) if (!playlength) { std::string eMsg = "missing attribute "; eMsg += playlengthAttrName; + eMsg += " or metadata element "; + eMsg += extentElementPrefix + ":" + extentElementName; throw std::invalid_argument(eMsg); } + + Ptr::Ref playlengthString(new Glib::ustring( + to_simple_string(*playlength) )); + setMetadata(playlengthString, extentElementName, extentElementPrefix); } /*------------------------------------------------------------------------------ * Return the value of a metadata field. *----------------------------------------------------------------------------*/ -Ptr::Ref -AudioClip :: getMetadata(const string &key) const +Ptr::Ref +AudioClip :: getMetadata(const string &key, const std::string &ns) const throw () { - metadataType::const_iterator it = metadata.find(key); + Ptr::Ref value; - if (it != metadata.end()) { - return it->second; + if (! xmlAudioClip) { + return value; } - else { - Ptr::Ref nullPointer; - return nullPointer; + xmlpp::Element* rootNode = xmlAudioClip->get_root_node(); + if (! rootNode) { + return value; } + xmlpp::Node::NodeList rootList = rootNode->get_children("metadata"); + if (rootList.size() == 0) { + return value; + } + + xmlpp::Node* metadata = rootList.front(); + xmlpp::Node::NodeList nodeList = metadata->get_children(key); + xmlpp::Node::NodeList::iterator it = nodeList.begin(); + + while (it != nodeList.end()) { + xmlpp::Node* node = *it; + if (node->get_namespace_prefix() == ns) { + xmlpp::Element* element = dynamic_cast (node); + value.reset(new Glib::ustring(element->get_child_text() + ->get_content())); + return value; + } + ++it; + } + + return value; } @@ -196,23 +317,63 @@ AudioClip :: getMetadata(const string &key) const * Set the value of a metadata field. *----------------------------------------------------------------------------*/ void -AudioClip :: setMetadata(const string &key, Ptr::Ref value) +AudioClip :: setMetadata(Ptr::Ref value, const std::string &key, + const std::string &ns) throw () { - metadata[key] = value; -} - - -/*------------------------------------------------------------------------------ - * Create an XML document from this audio clip. - *----------------------------------------------------------------------------*/ -Ptr::Ref -AudioClip :: toXml() - throw () -{ - Ptr::Ref metadata(new xmlpp::Document); - metadata->create_root_node("metadata"); - metadata->add_comment("some data will come here"); - return metadata; + if (ns == extentElementPrefix && key == extentElementName) { + playlength.reset(new time_duration( + duration_from_string(*value) )); + } + + if (ns == titleElementPrefix && key == titleElementName) { + title = value; + } + + if (! xmlAudioClip) { + xmlAudioClip.reset(new xmlpp::Document); + } + xmlpp::Element* rootNode = xmlAudioClip->get_root_node(); + if (! rootNode) { + rootNode = xmlAudioClip->create_root_node("audioClip"); + } + xmlpp::Node::NodeList rootList = rootNode->get_children("metadata"); + xmlpp::Element* metadata; + if (rootList.size() > 0) { + metadata = dynamic_cast (rootList.front()); + } + else { + metadata = rootNode->add_child("metadata"); + metadata->set_namespace_declaration(defaultPrefixUri); + metadata->set_namespace_declaration(titleElementUri, + titleElementPrefix); + metadata->set_namespace_declaration(extentElementUri, + extentElementPrefix); + } + + xmlpp::Node::NodeList nodeList = metadata->get_children(key); + xmlpp::Node::NodeList::iterator it = nodeList.begin(); + xmlpp::Element* element; + + while (it != nodeList.end()) { + xmlpp::Node* node = *it; + if (node->get_namespace_prefix() == ns) { + element = dynamic_cast (nodeList.front()); + break; + } + ++it; + } + + if (it == nodeList.end()) { + element = metadata->add_child(key); + try { + element->set_namespace(ns); + } + catch (xmlpp::exception &e) { + // this namespace has not been declared; well OK, do nothing then + } + } + + element->set_child_text(*value); } diff --git a/livesupport/modules/core/src/AudioClipTest.cxx b/livesupport/modules/core/src/AudioClipTest.cxx index 559a14a6b..a1b264808 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.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -95,7 +95,7 @@ AudioClipTest :: firstTest(void) { try { Ptr::Ref parser( - new xmlpp::DomParser(configFileName, false)); + new xmlpp::DomParser(configFileName, false)); const xmlpp::Document * document = parser->get_document(); const xmlpp::Element * root = document->get_root_node(); Ptr::Ref audioClip(new AudioClip()); @@ -103,13 +103,27 @@ AudioClipTest :: firstTest(void) audioClip->configure(*root); CPPUNIT_ASSERT(audioClip->getId()->getId() == 1); - Ptr::Ref duration = audioClip->getPlaylength(); CPPUNIT_ASSERT(duration->hours() == 0); CPPUNIT_ASSERT(duration->minutes() == 18); CPPUNIT_ASSERT(duration->seconds() == 30); + Ptr::Ref title = audioClip->getTitle(); + CPPUNIT_ASSERT(title); + CPPUNIT_ASSERT(*title == "File Title txt"); + + Ptr::Ref subject = audioClip + ->getMetadata("subject", "dc"); + CPPUNIT_ASSERT(subject); + CPPUNIT_ASSERT(*subject == "Keywords: qwe, asd, zcx"); + + Ptr::Ref alternativeTitle = audioClip + ->getMetadata("alternative", "dcterms"); + CPPUNIT_ASSERT(alternativeTitle); + CPPUNIT_ASSERT(*alternativeTitle == + "Alternative File Title ín sőmé %$#@* LÁNGŰAGÉ"); + } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { diff --git a/livesupport/modules/core/src/FadeInfo.cxx b/livesupport/modules/core/src/FadeInfo.cxx index f1f0f874e..07e8cb71f 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.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/FadeInfo.cxx,v $ ------------------------------------------------------------------------------*/ @@ -86,16 +86,15 @@ FadeInfo :: configure(const xmlpp::Element & element) } const xmlpp::Attribute * attribute; - std::stringstream strStr; - unsigned long int idValue; if (!(attribute = element.get_attribute(idAttrName))) { std::string eMsg = "missing attribute "; eMsg += idAttrName; throw std::invalid_argument(eMsg); } - strStr.str(attribute->get_value()); - strStr >> idValue; + std::stringstream idStream(attribute->get_value()); + UniqueId::IdType idValue; + idStream >> idValue; id.reset(new UniqueId(idValue)); if (!(attribute = element.get_attribute(fadeInAttrName))) { diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index 4baa67c7c..4c9eb177a 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.16 $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -86,16 +86,15 @@ Playlist :: configure(const xmlpp::Element & element) } const xmlpp::Attribute * attribute; - std::stringstream strStr; - unsigned long int idValue; if (!(attribute = element.get_attribute(idAttrName))) { std::string eMsg = "missing attribute "; eMsg += idAttrName; throw std::invalid_argument(eMsg); } - strStr.str(attribute->get_value()); - strStr >> idValue; + std::stringstream idStream(attribute->get_value()); + UniqueId::IdType idValue; + idStream >> idValue; id.reset(new UniqueId(idValue)); if (!(attribute = element.get_attribute(playlengthAttrName))) { @@ -369,17 +368,18 @@ Playlist::revertToSavedCopy(void) throw (std::invalid_argument) /*------------------------------------------------------------------------------ * Return the value of a metadata field. *----------------------------------------------------------------------------*/ -Ptr::Ref -Playlist :: getMetadata(const string &key) const +Ptr::Ref +Playlist :: getMetadata(const string &key, const string &ns) const throw () { - metadataType::const_iterator it = metadata.find(key); + std::string completeKey = key + ns; + metadataType::const_iterator it = metadata.find(completeKey); if (it != metadata.end()) { return it->second; } else { - Ptr::Ref nullPointer; + Ptr::Ref nullPointer; return nullPointer; } } @@ -389,9 +389,11 @@ Playlist :: getMetadata(const string &key) const * Set the value of a metadata field. *----------------------------------------------------------------------------*/ void -Playlist :: setMetadata(const string &key, Ptr::Ref value) +Playlist :: setMetadata(Ptr::Ref value, const string &key, + const string &ns) throw () { - metadata[key] = value; + std::string completeKey = key + ns; + metadata[completeKey] = value; } diff --git a/livesupport/modules/core/src/PlaylistElement.cxx b/livesupport/modules/core/src/PlaylistElement.cxx index 1074692ee..305645d14 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.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistElement.cxx,v $ ------------------------------------------------------------------------------*/ @@ -97,17 +97,16 @@ PlaylistElement :: configure(const xmlpp::Element & element) } // set id - const xmlpp::Attribute * attribute; - std::stringstream strStr; - UniqueId::IdType idValue; + const xmlpp::Attribute* attribute; if (!(attribute = element.get_attribute(idAttrName))) { std::string eMsg = "missing attribute "; eMsg += idAttrName; throw std::invalid_argument(eMsg); } - strStr.str(attribute->get_value()); - strStr >> idValue; + std::stringstream idStream(attribute->get_value()); + UniqueId::IdType idValue; + idStream >> idValue; id.reset(new UniqueId(idValue)); // set relative offset diff --git a/livesupport/modules/storage/etc/Makefile.in b/livesupport/modules/storage/etc/Makefile.in index fcb0c3ef7..2f6259bb0 100644 --- a/livesupport/modules/storage/etc/Makefile.in +++ b/livesupport/modules/storage/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: fgerlits $ -# Version : $Revision: 1.13 $ +# Version : $Revision: 1.14 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/etc/Makefile.in,v $ # # @configure_input@ @@ -73,10 +73,6 @@ VPATH = ${SRC_DIR} LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@ LIBXMLPP_LIBS=@LIBXMLPP_LIBS@ -# TODO: move ICU flag determination to configure script -ICU_CFLAGS= -ICU_LIBS=`${USR_DIR}/bin/icu-config --ldflags --ldflags-toolutil --ldflags-icuio` - CURL_LIBS=`${USR_DIR}/bin/curl-config --libs` TEST_RESULTS = ${DOC_DIR}/testResults.xml @@ -97,14 +93,12 @@ CPPFLAGS = @CPPFLAGS@ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \ -pedantic -Wall -Wno-long-long \ -I${USR_INCLUDE_DIR} \ - ${ICU_CFLAGS} \ ${LIBXMLPP_CFLAGS} \ -I${BOOST_INCLUDE_DIR} \ -I${CORE_INCLUDE_DIR} \ -I${AUTHENTICATION_INCLUDE_DIR} \ -I${INCLUDE_DIR} -I${TMP_DIR} LDFLAGS = @LDFLAGS@ -pthread \ - ${ICU_LIBS} \ ${LIBXMLPP_LIBS} \ ${CURL_LIBS} \ -L${USR_LIB_DIR} \ @@ -126,7 +120,7 @@ TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \ ${TMP_DIR}/WebStorageClientTest.o TEST_RUNNER_LIBS = -l${STORAGE_LIB} -l${CORE_LIB} -l${AUTHENTICATION_LIB} \ - ${ICU_LIBS} -lcppunit -ldl -lxmlrpc++ -lssl + -lcppunit -ldl -lxmlrpc++ -lssl #------------------------------------------------------------------------------- diff --git a/livesupport/modules/storage/src/WebStorageClient.cxx b/livesupport/modules/storage/src/WebStorageClient.cxx index 72b91a09a..18ffdaed9 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.13 $ + Version : $Revision: 1.14 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $ ------------------------------------------------------------------------------*/ @@ -588,6 +588,7 @@ WebStorageClient :: getAudioClip(Ptr::Ref sessionId, const xmlpp::Element * root = document->get_root_node(); audioClip->configure(*root); + } catch (std::invalid_argument &e) { throw XmlRpcMethodResponseException( "semantic error in audio clip metafile"); diff --git a/livesupport/modules/storage/src/WebStorageClientTest.cxx b/livesupport/modules/storage/src/WebStorageClientTest.cxx index 52f9157ab..217d98448 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.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -247,19 +247,18 @@ WebStorageClientTest :: audioClipTest(void) CPPUNIT_FAIL(e.what()); } -/* this doesn't work yet Ptr::Ref newAudioClip; try { - newAudioClip = wsc->getAudioClip(sessionId, id01); + newAudioClip = wsc->getAudioClip(sessionId, id02); } catch (StorageException &e) { CPPUNIT_FAIL(e.what()); } - CPPUNIT_ASSERT(std::string(*newAudioClip->getId()) == std::string(*id01)); + CPPUNIT_ASSERT(std::string(*newAudioClip->getId()) == std::string(*id02)); CPPUNIT_ASSERT(newAudioClip->getPlaylength()->total_seconds() == audioClip->getPlaylength()->total_seconds()); -*/ + try{ authentication->logout(sessionId); } diff --git a/livesupport/modules/storageServer/var/tests/mdata1.xml b/livesupport/modules/storageServer/var/tests/mdata1.xml index 98a7cd30a..107601583 100644 --- a/livesupport/modules/storageServer/var/tests/mdata1.xml +++ b/livesupport/modules/storageServer/var/tests/mdata1.xml @@ -18,7 +18,7 @@ 2004-05-25 Sound audio/mpeg -123 +0:2:3 online streamonthefly: http://some.url.mdlf.org/ diff --git a/livesupport/modules/storageServer/var/tests/mdata2.xml b/livesupport/modules/storageServer/var/tests/mdata2.xml index 617e28ca1..bccf49eac 100644 --- a/livesupport/modules/storageServer/var/tests/mdata2.xml +++ b/livesupport/modules/storageServer/var/tests/mdata2.xml @@ -17,7 +17,7 @@ 2004-05-25 Sound audio/mpeg -123 +00:02:03 online streamonthefly: http://some.url.mdlf.org/ @@ -30,4 +30,4 @@ John X 123456789 -
\ No newline at end of file + diff --git a/livesupport/products/scheduler/etc/Makefile.in b/livesupport/products/scheduler/etc/Makefile.in index 356be60b5..687823d35 100644 --- a/livesupport/products/scheduler/etc/Makefile.in +++ b/livesupport/products/scheduler/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: fgerlits $ -# Version : $Revision: 1.36 $ +# Version : $Revision: 1.37 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $ # # @configure_input@ @@ -65,10 +65,6 @@ VPATH = ${SRC_DIR} LIBXMLPP_CFLAGS=@LIBXMLPP_CFLAGS@ LIBXMLPP_LIBS=@LIBXMLPP_LIBS@ -# TODO: move ICU flag determination to configure script -ICU_CFLAGS= -ICU_LIBS=`${USR_DIR}/bin/icu-config --ldflags --ldflags-toolutil --ldflags-icuio` - CURL_LIBS=`${USR_DIR}/bin/curl-config --libs` MODULES_DIR = ${BASE_DIR}/../../modules @@ -130,7 +126,6 @@ export LD_LIBRARY_PATH=${USR_LIB_DIR} CPPFLAGS = @CPPFLAGS@ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \ -pedantic -Wall -Wno-long-long \ - ${ICU_CFLAGS} \ ${LIBXMLPP_CFLAGS} \ -I${USR_INCLUDE_DIR} \ -I${BOOST_INCLUDE_DIR} \ @@ -143,7 +138,6 @@ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \ -I${TMP_DIR} LDFLAGS = @LDFLAGS@ -pthread \ ${LIBXMLPP_LIBS} \ - ${ICU_LIBS} \ ${CURL_LIBS} \ -L${USR_LIB_DIR} \ -L${HELIX_LIB_DIR} \ @@ -235,7 +229,7 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \ ${TMP_DIR}/UpdateFadeInFadeOutMethodTest.o \ ${TMP_DIR}/PlaylistEventContainerTest.o \ ${TMP_DIR}/PlaylistEventTest.o -TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} ${ICU_LIBS} -lcppunit -ldl +TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl #-------------------------------------------------------------------------------