Finally got reading from the storage server to work. Yippee!
This commit is contained in:
parent
48be2884b4
commit
288ad456be
|
@ -1,9 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!DOCTYPE audioClip [
|
<audioClip id="1" playlength="00:18:30.000" uri="file:var/test1.mp3">
|
||||||
|
<metadata
|
||||||
<!ELEMENT audioClip EMPTY >
|
xmlns="http://www.streamonthefly.org/"
|
||||||
<!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
<!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||||
<!ATTLIST audioClip uri CDATA #IMPLIED >
|
xmlns:xbmf="http://www.streamonthefly.org/xbmf"
|
||||||
]>
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<audioClip id="1" playlength="00:18:30.000" uri="file:var/test1.mp3" />
|
>
|
||||||
|
<dc:title >File Title txt</dc:title>
|
||||||
|
<dcterms:alternative >Alternative File Title ín sőmé %$#@* LÁNGŰAGÉ</dcterms:alternative>
|
||||||
|
<dc:subject >Keywords: qwe, asd, zcx</dc:subject>
|
||||||
|
<dc:description >Abstract txt</dc:description>
|
||||||
|
<dc:date >2004-05-21</dc:date>
|
||||||
|
<dcterms:available >2004-05-22</dcterms:available>
|
||||||
|
<dcterms:issued >2004-05-23</dcterms:issued>
|
||||||
|
<dcterms:modified >2004-05-24</dcterms:modified>
|
||||||
|
<dcterms:valid >2004-05-25</dcterms:valid>
|
||||||
|
<dc:type xsi:type="dcterms:DCMIType" >Sound</dc:type>
|
||||||
|
<dc:format xsi:type="dcterms:IMT" >audio/mpeg</dc:format>
|
||||||
|
<dcterms:extent >123</dcterms:extent>
|
||||||
|
<dcterms:medium >online</dcterms:medium>
|
||||||
|
<dc:identifier >streamonthefly:</dc:identifier>
|
||||||
|
<dc:identifier >http://some.url.mdlf.org/</dc:identifier>
|
||||||
|
<dcterms:spatial >Spatial Coverage</dcterms:spatial>
|
||||||
|
<dcterms:temporal >Temporal Covarage</dcterms:temporal>
|
||||||
|
<xbmf:episodetitle >Episode Title txt</xbmf:episodetitle>
|
||||||
|
<xbmf:episodesequence >Episode sequence</xbmf:episodesequence>
|
||||||
|
<xbmf:contributor>
|
||||||
|
<xbmf:role>Editor</xbmf:role>
|
||||||
|
<xbmf:name>John X</xbmf:name>
|
||||||
|
<xbmf:phone>123456789</xbmf:phone>
|
||||||
|
</xbmf:contributor>
|
||||||
|
</metadata>
|
||||||
|
</audioClip>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.10 $
|
Version : $Revision: 1.11 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -78,24 +78,43 @@ using namespace boost::posix_time;
|
||||||
* <pre><code>
|
* <pre><code>
|
||||||
* <audioClip id="1"
|
* <audioClip id="1"
|
||||||
* playlength="00:18:30.000000"
|
* playlength="00:18:30.000000"
|
||||||
* uri="file:var/test1.mp3"
|
* uri="file:var/test1.mp3" >
|
||||||
|
* <metadata
|
||||||
|
* xmlns="http://www.streamonthefly.org/"
|
||||||
|
* xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
* xmlns:dcterms="http://purl.org/dc/terms/"
|
||||||
|
* xmlns:xbmf="http://www.streamonthefly.org/xbmf"
|
||||||
|
* xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
|
||||||
|
* <dc:title >File Title txt</dc:title>
|
||||||
|
* <dcterms:extent >123</dcterms:extent>
|
||||||
|
* ...
|
||||||
|
* </metadata>
|
||||||
* </audioClip>
|
* </audioClip>
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
|
* The metadata element is optional. The <code>configure()</code> method
|
||||||
|
* sets only those fields which had not been set previously: e.g., if we set
|
||||||
|
* some or all fields of the AudioClip in the constructor, then these fields
|
||||||
|
* in the XML element will be ignored by <code>configure()</code>. If both the
|
||||||
|
* <code>playlength</code> attribute and the
|
||||||
|
* <code><dcterms:extent></code>
|
||||||
|
* element are present, then the playlength is set from the attribute and
|
||||||
|
* <code><dcterms:extent></code> is ignored.
|
||||||
|
*
|
||||||
* The URI is not normally part of the XML element; it's only included
|
* The URI is not normally part of the XML element; it's only included
|
||||||
* as an optional attribute for testing purposes.
|
* as an optional attribute for testing purposes.
|
||||||
*
|
*
|
||||||
* The DTD for the above element is:
|
* The DTD for the above element is:
|
||||||
*
|
*
|
||||||
* <pre><code>
|
* <pre><code>
|
||||||
* <!ELEMENT audioClip EMPTY >
|
* <!ELEMENT audioClip (metadata?) >
|
||||||
* <!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
* <!ATTLIST audioClip id NMTOKEN #REQUIRED >
|
||||||
* <!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
* <!ATTLIST audioClip playlength NMTOKEN #REQUIRED >
|
||||||
* <!ATTLIST audioClip uri CDATA #IMPLIED >
|
* <!ATTLIST audioClip uri CDATA #IMPLIED >
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.10 $
|
* @version $Revision: 1.11 $
|
||||||
*/
|
*/
|
||||||
class AudioClip : public Configurable,
|
class AudioClip : public Configurable,
|
||||||
public Playable
|
public Playable
|
||||||
|
@ -135,6 +154,18 @@ class AudioClip : public Configurable,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an audio clip by specifying its unique ID.
|
||||||
|
* The other fields will be filled in by configure().
|
||||||
|
*
|
||||||
|
* @param id the id of the audio clip.
|
||||||
|
*/
|
||||||
|
AudioClip(Ptr<UniqueId>::Ref id)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
this->id = id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an audio clip by specifying all details.
|
* Create an audio clip by specifying all details.
|
||||||
* This is used for testing purposes.
|
* This is used for testing purposes.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,7 +71,7 @@ using namespace LiveSupport;
|
||||||
* A helper object holding static time conversion functions.
|
* A helper object holding static time conversion functions.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.6 $
|
||||||
*/
|
*/
|
||||||
class TimeConversion
|
class TimeConversion
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,8 @@ class TimeConversion
|
||||||
* Convert a boost::posix_time::ptime to a struct tm,
|
* Convert a boost::posix_time::ptime to a struct tm,
|
||||||
* with second precision.
|
* with second precision.
|
||||||
*
|
*
|
||||||
* @param time the boost::posix_time::ptime to convert.
|
* @param convertFrom the boost::posix_time::ptime to convert.
|
||||||
|
* @param convertTo holds the result of the conversion
|
||||||
* @return a struct tm, holding the same time.
|
* @return a struct tm, holding the same time.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.7 $
|
Version : $Revision: 1.8 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -51,6 +51,21 @@ using namespace LiveSupport::Core;
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
const std::string AudioClip::configElementNameStr = "audioClip";
|
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.
|
* The name of the attribute to get the id of the audio clip.
|
||||||
*/
|
*/
|
||||||
|
@ -66,6 +81,7 @@ static const std::string uriAttrName = "uri";
|
||||||
*/
|
*/
|
||||||
static const std::string playlengthAttrName = "playlength";
|
static const std::string playlengthAttrName = "playlength";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,29 +101,74 @@ AudioClip :: configure(const xmlpp::Element & element)
|
||||||
}
|
}
|
||||||
|
|
||||||
const xmlpp::Attribute * attribute;
|
const xmlpp::Attribute * attribute;
|
||||||
std::stringstream strStr;
|
|
||||||
unsigned long int idValue;
|
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
if (!(attribute = element.get_attribute(idAttrName))) {
|
if (!(attribute = element.get_attribute(idAttrName))) {
|
||||||
std::string eMsg = "missing attribute ";
|
std::string eMsg = "missing attribute ";
|
||||||
eMsg += idAttrName;
|
eMsg += idAttrName;
|
||||||
throw std::invalid_argument(eMsg);
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
strStr.str(attribute->get_value());
|
std::stringstream strStr(attribute->get_value());
|
||||||
|
UniqueId::IdType idValue;
|
||||||
strStr >> idValue;
|
strStr >> idValue;
|
||||||
id.reset(new UniqueId(idValue));
|
id.reset(new UniqueId(idValue));
|
||||||
|
|
||||||
if (!(attribute = element.get_attribute(playlengthAttrName))) {
|
|
||||||
std::string eMsg = "missing attribute ";
|
|
||||||
eMsg += idAttrName;
|
|
||||||
throw std::invalid_argument(eMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!playlength
|
||||||
|
&& (attribute = element.get_attribute(playlengthAttrName))) {
|
||||||
playlength.reset(new time_duration(
|
playlength.reset(new time_duration(
|
||||||
duration_from_string(attribute->get_value())));
|
duration_from_string(attribute->get_value())));
|
||||||
|
}
|
||||||
|
|
||||||
if ((attribute = element.get_attribute(uriAttrName))) {
|
if (!uri
|
||||||
std::string uriValue = attribute->get_value();
|
&& (attribute = element.get_attribute(uriAttrName))) {
|
||||||
uri.reset(new std::string(uriValue));
|
uri.reset(new std::string(attribute->get_value()));
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlpp::Node::NodeList childNodes
|
||||||
|
= element.get_children(metadataElementName);
|
||||||
|
xmlpp::Node::NodeList::iterator it = childNodes.begin();
|
||||||
|
|
||||||
|
if (it != childNodes.end()) {
|
||||||
|
const xmlpp::Element * metadataElement
|
||||||
|
= dynamic_cast<const xmlpp::Element*> (*it);
|
||||||
|
|
||||||
|
xmlpp::Node::NodeList dataFieldList
|
||||||
|
= metadataElement->get_children();
|
||||||
|
xmlpp::Node::NodeList::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<const xmlpp::Element*> (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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++listIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
if (it != childNodes.end()) {
|
||||||
|
std::string eMsg = "more than one ";
|
||||||
|
eMsg += metadataElementName;
|
||||||
|
eMsg += " XML element";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playlength) {
|
||||||
|
std::string eMsg = "missing attribute ";
|
||||||
|
eMsg += playlengthAttrName;
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClipTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -95,7 +95,7 @@ AudioClipTest :: firstTest(void)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Ptr<xmlpp::DomParser>::Ref parser(
|
Ptr<xmlpp::DomParser>::Ref parser(
|
||||||
new xmlpp::DomParser(configFileName, true));
|
new xmlpp::DomParser(configFileName, false));
|
||||||
const xmlpp::Document * document = parser->get_document();
|
const xmlpp::Document * document = parser->get_document();
|
||||||
const xmlpp::Element * root = document->get_root_node();
|
const xmlpp::Element * root = document->get_root_node();
|
||||||
Ptr<AudioClip>::Ref audioClip(new AudioClip());
|
Ptr<AudioClip>::Ref audioClip(new AudioClip());
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.10 $
|
# Version : $Revision: 1.11 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -147,7 +147,7 @@ depclean: clean
|
||||||
distclean: clean docclean
|
distclean: clean docclean
|
||||||
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
||||||
|
|
||||||
check: all ${TEST_RUNNER}
|
check: all storage_server_init ${TEST_RUNNER}
|
||||||
LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER} \
|
LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER} \
|
||||||
-o ${TEST_RESULTS} -s ${TEST_XSLT}
|
-o ${TEST_RESULTS} -s ${TEST_XSLT}
|
||||||
|
|
||||||
|
@ -170,6 +170,9 @@ ${TEST_RUNNER}: ${CORE_LIB_FILE} ${TEST_RUNNER_OBJS} ${STORAGE_LIB_FILE}
|
||||||
${CORE_LIB_FILE}:
|
${CORE_LIB_FILE}:
|
||||||
${MAKE} -C ${CORE_DIR}
|
${MAKE} -C ${CORE_DIR}
|
||||||
|
|
||||||
|
storage_server_init:
|
||||||
|
${MAKE} -C ${BASE_DIR}/../storageServer
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Pattern rules
|
# Pattern rules
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.8 $
|
Version : $Revision: 1.9 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -202,8 +202,14 @@ static const std::string existsAudioClipMethodResultParamName = "exists";
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* The name of the get audio clip method on the storage server
|
* The name of the get audio clip method on the storage server
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static const std::string getAudioClipMethodName
|
static const std::string getAudioClipOpenMethodName
|
||||||
= "locstor.getAudioClip";
|
= "locstor.downloadMetadataOpen";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the get audio clip method on the storage server
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string getAudioClipCloseMethodName
|
||||||
|
= "locstor.downloadMetadataClose";
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* The name of the session ID parameter in the input structure
|
* The name of the session ID parameter in the input structure
|
||||||
|
@ -216,9 +222,19 @@ static const std::string getAudioClipMethodSessionIdParamName = "sessid";
|
||||||
static const std::string getAudioClipMethodAudioClipIdParamName = "gunid";
|
static const std::string getAudioClipMethodAudioClipIdParamName = "gunid";
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* The name of the result parameter returned by the method
|
* The name of the result URL parameter returned by the method
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
static const std::string getAudioClipMethodResultParamName = "metadata";
|
static const std::string getAudioClipMethodUrlParamName = "url";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the token parameter returned (for open) or input (for close)
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string getAudioClipMethodTokenParamName = "token";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The name of the status parameter returned by the close method
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const std::string getAudioClipMethodStatusParamName = "status";
|
||||||
|
|
||||||
|
|
||||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: storeAudioClip */
|
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: storeAudioClip */
|
||||||
|
@ -457,11 +473,13 @@ WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
||||||
storageServerPath.c_str(), false);
|
storageServerPath.c_str(), false);
|
||||||
|
|
||||||
|
parameters.clear();
|
||||||
parameters[existsAudioClipMethodSessionIdParamName]
|
parameters[existsAudioClipMethodSessionIdParamName]
|
||||||
= sessionId->getId();
|
= sessionId->getId();
|
||||||
parameters[existsAudioClipMethodAudioClipIdParamName]
|
parameters[existsAudioClipMethodAudioClipIdParamName]
|
||||||
= std::string(*id);
|
= std::string(*id);
|
||||||
|
|
||||||
|
result.clear();
|
||||||
if (!xmlRpcClient.execute(existsAudioClipMethodName.c_str(),
|
if (!xmlRpcClient.execute(existsAudioClipMethodName.c_str(),
|
||||||
parameters, result)) {
|
parameters, result)) {
|
||||||
std::string eMsg = "cannot execute XML-RPC method '";
|
std::string eMsg = "cannot execute XML-RPC method '";
|
||||||
|
@ -487,7 +505,7 @@ WebStorageClient :: existsAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Return an audio clip.
|
* Retrieve an audio clip from the storage.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<AudioClip>::Ref
|
Ptr<AudioClip>::Ref
|
||||||
WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
|
WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
|
@ -500,32 +518,39 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
||||||
storageServerPath.c_str(), false);
|
storageServerPath.c_str(), false);
|
||||||
|
|
||||||
|
parameters.clear();
|
||||||
parameters[getAudioClipMethodSessionIdParamName]
|
parameters[getAudioClipMethodSessionIdParamName]
|
||||||
= sessionId->getId();
|
= sessionId->getId();
|
||||||
parameters[getAudioClipMethodAudioClipIdParamName]
|
parameters[getAudioClipMethodAudioClipIdParamName]
|
||||||
= std::string(*id);
|
= std::string(*id);
|
||||||
|
|
||||||
if (!xmlRpcClient.execute(getAudioClipMethodName.c_str(),
|
result.clear();
|
||||||
|
if (!xmlRpcClient.execute(getAudioClipOpenMethodName.c_str(),
|
||||||
parameters, result)) {
|
parameters, result)) {
|
||||||
std::string eMsg = "cannot execute XML-RPC method '";
|
std::string eMsg = "cannot execute XML-RPC method '";
|
||||||
eMsg += getAudioClipMethodName;
|
eMsg += getAudioClipOpenMethodName;
|
||||||
eMsg += "'";
|
eMsg += "'";
|
||||||
throw std::logic_error(eMsg);
|
throw std::logic_error(eMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlRpcClient.isFault()
|
if (xmlRpcClient.isFault()
|
||||||
|| ! result.hasMember(getAudioClipMethodResultParamName)
|
|| ! result.hasMember(getAudioClipMethodUrlParamName)
|
||||||
|| result[getAudioClipMethodResultParamName].getType()
|
|| result[getAudioClipMethodUrlParamName].getType()
|
||||||
|
!= XmlRpcValue::TypeString
|
||||||
|
|| ! result.hasMember(getAudioClipMethodTokenParamName)
|
||||||
|
|| result[getAudioClipMethodTokenParamName].getType()
|
||||||
!= XmlRpcValue::TypeString) {
|
!= XmlRpcValue::TypeString) {
|
||||||
std::stringstream eMsg;
|
std::stringstream eMsg;
|
||||||
eMsg << "XML-RPC method '"
|
eMsg << "XML-RPC method '"
|
||||||
<< getAudioClipMethodName
|
<< getAudioClipOpenMethodName
|
||||||
<< "' returned error message:\n"
|
<< "' returned error message:\n"
|
||||||
<< result;
|
<< result;
|
||||||
throw std::logic_error(eMsg.str());
|
throw std::logic_error(eMsg.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string xmlAudioClip(result[getAudioClipMethodResultParamName]);
|
std::string url = result[getAudioClipMethodUrlParamName];
|
||||||
|
std::string token = result[getAudioClipMethodTokenParamName];
|
||||||
|
/*
|
||||||
int offset = 353;
|
int offset = 353;
|
||||||
std::cout << "\n" << xmlAudioClip.at(offset+0) << "\n";
|
std::cout << "\n" << xmlAudioClip.at(offset+0) << "\n";
|
||||||
std::cout << xmlAudioClip.at(offset+1) << "\n";
|
std::cout << xmlAudioClip.at(offset+1) << "\n";
|
||||||
|
@ -548,16 +573,15 @@ std::cout << xmlAudioClip.at(offset+17) << "\n";
|
||||||
std::cout << xmlAudioClip.at(offset+18) << "\n";
|
std::cout << xmlAudioClip.at(offset+18) << "\n";
|
||||||
std::cout << xmlAudioClip.at(offset+19) << "\n";
|
std::cout << xmlAudioClip.at(offset+19) << "\n";
|
||||||
std::cout << xmlAudioClip.at(offset+20) << "\n";
|
std::cout << xmlAudioClip.at(offset+20) << "\n";
|
||||||
|
*/
|
||||||
Ptr<AudioClip>::Ref audioClip;
|
Ptr<AudioClip>::Ref audioClip(new AudioClip(id));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Ptr<xmlpp::DomParser>::Ref parser(new xmlpp::DomParser());
|
Ptr<xmlpp::DomParser>::Ref parser(new xmlpp::DomParser());
|
||||||
parser->parse_memory(xmlAudioClip);
|
parser->parse_file(url);
|
||||||
const xmlpp::Document * document = parser->get_document();
|
const xmlpp::Document * document = parser->get_document();
|
||||||
const xmlpp::Element * root = document->get_root_node();
|
const xmlpp::Element * root = document->get_root_node();
|
||||||
|
|
||||||
audioClip.reset(new AudioClip);
|
|
||||||
audioClip->configure(*root);
|
audioClip->configure(*root);
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
throw std::logic_error("semantic error in audio clip metafile");
|
throw std::logic_error("semantic error in audio clip metafile");
|
||||||
|
@ -565,6 +589,34 @@ std::cout << xmlAudioClip.at(offset+20) << "\n";
|
||||||
throw std::logic_error("error parsing audio clip metafile");
|
throw std::logic_error("error parsing audio clip metafile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameters.clear();
|
||||||
|
parameters[getAudioClipMethodSessionIdParamName]
|
||||||
|
= sessionId->getId();
|
||||||
|
parameters[getAudioClipMethodTokenParamName]
|
||||||
|
= token;
|
||||||
|
|
||||||
|
result.clear();
|
||||||
|
if (!xmlRpcClient.execute(getAudioClipCloseMethodName.c_str(),
|
||||||
|
parameters, result)) {
|
||||||
|
std::string eMsg = "cannot execute XML-RPC method '";
|
||||||
|
eMsg += getAudioClipCloseMethodName;
|
||||||
|
eMsg += "'";
|
||||||
|
throw std::logic_error(eMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xmlRpcClient.isFault()
|
||||||
|
|| ! result.hasMember(getAudioClipMethodStatusParamName)
|
||||||
|
|| result[getAudioClipMethodStatusParamName].getType()
|
||||||
|
!= XmlRpcValue::TypeBoolean
|
||||||
|
|| ! bool(result[getAudioClipMethodStatusParamName])) {
|
||||||
|
std::stringstream eMsg;
|
||||||
|
eMsg << "XML-RPC method '"
|
||||||
|
<< getAudioClipCloseMethodName
|
||||||
|
<< "' returned error message:\n"
|
||||||
|
<< result;
|
||||||
|
throw std::logic_error(eMsg.str());
|
||||||
|
}
|
||||||
|
|
||||||
return audioClip;
|
return audioClip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +686,7 @@ WebStorageClient :: storeAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
|| result.getType() != XmlRpcValue::TypeString) {
|
|| result.getType() != XmlRpcValue::TypeString) {
|
||||||
std::stringstream eMsg;
|
std::stringstream eMsg;
|
||||||
eMsg << "XML-RPC method '"
|
eMsg << "XML-RPC method '"
|
||||||
<< getAudioClipMethodName
|
<< storeAudioClipMethodName
|
||||||
<< "' returned error message:\n"
|
<< "' returned error message:\n"
|
||||||
<< result;
|
<< result;
|
||||||
throw std::logic_error(eMsg.str());
|
throw std::logic_error(eMsg.str());
|
||||||
|
@ -709,8 +761,10 @@ WebStorageClient :: reset(void)
|
||||||
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
XmlRpcClient xmlRpcClient(storageServerName.c_str(), storageServerPort,
|
||||||
storageServerPath.c_str(), false);
|
storageServerPath.c_str(), false);
|
||||||
|
|
||||||
|
parameters.clear();
|
||||||
parameters["dummy_param"] = "dummy_value";
|
parameters["dummy_param"] = "dummy_value";
|
||||||
|
|
||||||
|
result.clear();
|
||||||
if (!xmlRpcClient.execute(resetStorageMethodName.c_str(),
|
if (!xmlRpcClient.execute(resetStorageMethodName.c_str(),
|
||||||
parameters, result)) {
|
parameters, result)) {
|
||||||
std::string eMsg = "cannot execute XML-RPC method '";
|
std::string eMsg = "cannot execute XML-RPC method '";
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.8 $
|
Version : $Revision: 1.9 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -165,7 +165,7 @@ WebStorageClientTest :: audioClipTest(void)
|
||||||
|
|
||||||
/* std::cout << "\nReset storage result:\n";
|
/* std::cout << "\nReset storage result:\n";
|
||||||
for (unsigned i=0; i<uniqueIdVector->size(); i++) {
|
for (unsigned i=0; i<uniqueIdVector->size(); i++) {
|
||||||
std::cout << std::hex << uniqueIdVector->at(i)->getId() << std::endl;
|
std::cout << std::hex << std::string(*uniqueIdVector->at(i)) << std::endl;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
Ptr<SessionId>::Ref sessionId = authentication->login("root", "q");
|
Ptr<SessionId>::Ref sessionId = authentication->login("root", "q");
|
||||||
|
@ -179,7 +179,7 @@ WebStorageClientTest :: audioClipTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(exists);
|
CPPUNIT_ASSERT(exists);
|
||||||
/*
|
|
||||||
Ptr<AudioClip>::Ref audioClip;
|
Ptr<AudioClip>::Ref audioClip;
|
||||||
try {
|
try {
|
||||||
audioClip = wsc->getAudioClip(sessionId, id01);
|
audioClip = wsc->getAudioClip(sessionId, id01);
|
||||||
|
@ -187,9 +187,7 @@ WebStorageClientTest :: audioClipTest(void)
|
||||||
catch (std::logic_error &e) {
|
catch (std::logic_error &e) {
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
std::cout << "\nid: " << audioClip->getId()->getId()
|
|
||||||
<< "\nplaylength: " << audioClip->getPlaylength() << "\n";
|
|
||||||
*/
|
|
||||||
Ptr<UniqueId>::Ref id77(new UniqueId(10077));
|
Ptr<UniqueId>::Ref id77(new UniqueId(10077));
|
||||||
try {
|
try {
|
||||||
exists = wsc->existsAudioClip(sessionId, id77);
|
exists = wsc->existsAudioClip(sessionId, id77);
|
||||||
|
@ -198,6 +196,7 @@ std::cout << "\nid: " << audioClip->getId()->getId()
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(!exists);
|
CPPUNIT_ASSERT(!exists);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Ptr<time_duration>::Ref playlength(new time_duration(0,0,11,0));
|
Ptr<time_duration>::Ref playlength(new time_duration(0,0,11,0));
|
||||||
Ptr<std::string>::Ref uri(new std::string("file:var/test10001.mp3"));
|
Ptr<std::string>::Ref uri(new std::string("file:var/test10001.mp3"));
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<audioClip>
|
||||||
<metadata
|
<metadata
|
||||||
xmlns="http://www.streamonthefly.org/"
|
xmlns="http://www.streamonthefly.org/"
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
@ -31,3 +32,4 @@
|
||||||
<xbmf:phone>123456789</xbmf:phone>
|
<xbmf:phone>123456789</xbmf:phone>
|
||||||
</xbmf:contributor>
|
</xbmf:contributor>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
</audioClip>
|
||||||
|
|
Loading…
Reference in New Issue