added storageAdmin module to doxygen config file;
added playlength format checking in AudioClip and Playlist in the Core module so it won't crash just throw an exception; added try-catch block in Storage::getAudioClip() and getPlaylist() to catch invalid audio clip or playlist format errors
This commit is contained in:
parent
d4557842f6
commit
40ffad79dd
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: fgerlits $
|
# Author : $Author: fgerlits $
|
||||||
# Version : $Revision: 1.12 $
|
# Version : $Revision: 1.13 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/etc/doxygen.config,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/etc/doxygen.config,v $
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -433,12 +433,13 @@ INPUT = modules/core/include modules/core/src \
|
||||||
modules/widgets/src \
|
modules/widgets/src \
|
||||||
products/scheduler/src \
|
products/scheduler/src \
|
||||||
products/gLiveSupport/src \
|
products/gLiveSupport/src \
|
||||||
modules/storageServer/var \
|
|
||||||
modules/storageServer/var/xmlrpc \
|
|
||||||
modules/alib/var \
|
modules/alib/var \
|
||||||
modules/alib/var/xmlrpc \
|
modules/alib/var/xmlrpc \
|
||||||
modules/getid3/var \
|
modules/getid3/var \
|
||||||
modules/archiveServer/var
|
modules/archiveServer/var \
|
||||||
|
modules/storageServer/var \
|
||||||
|
modules/storageServer/var/xmlrpc \
|
||||||
|
modules/storageAdmin/var
|
||||||
|
|
||||||
# If the value of the INPUT tag contains directories, you can use the
|
# If the value of the INPUT tag contains directories, you can use the
|
||||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.26 $
|
Version : $Revision: 1.27 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -131,7 +131,7 @@ using namespace boost::posix_time;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.26 $
|
* @version $Revision: 1.27 $
|
||||||
*/
|
*/
|
||||||
class AudioClip : public Configurable,
|
class AudioClip : public Configurable,
|
||||||
public Playable
|
public Playable
|
||||||
|
@ -178,11 +178,13 @@ class AudioClip : public Configurable,
|
||||||
* @param value the new value of the metadata field.
|
* @param value the new value of the metadata field.
|
||||||
* @param name the name of the metadata field (without prefix)
|
* @param name the name of the metadata field (without prefix)
|
||||||
* @param prefix the prefix of the metadata field
|
* @param prefix the prefix of the metadata field
|
||||||
|
* @exception std::invalid_argument if the key is dcterms:extent,
|
||||||
|
* but the value is not a valid ISO-8601 time
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &name, const std::string &prefix)
|
const std::string &name, const std::string &prefix)
|
||||||
throw ();
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a time_duration to string, in format HH:MM:SS.ssssss.
|
* Convert a time_duration to string, in format HH:MM:SS.ssssss.
|
||||||
|
@ -197,6 +199,17 @@ class AudioClip : public Configurable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the playlength member of this audio clip.
|
||||||
|
*
|
||||||
|
* @param timeString the new playlength
|
||||||
|
* @exception std::invalid_argument if the argument is not
|
||||||
|
* a valid ISO-8601 time
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setPlaylength(const std::string & timeString)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -496,11 +509,13 @@ class AudioClip : public Configurable,
|
||||||
*
|
*
|
||||||
* @param value the new value of the metadata field.
|
* @param value the new value of the metadata field.
|
||||||
* @param key the name of the metadata field
|
* @param key the name of the metadata field
|
||||||
|
* @exception std::invalid_argument if the key is dcterms:extent,
|
||||||
|
* but the value is not a valid ISO-8601 time
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &key)
|
const std::string &key)
|
||||||
throw ();
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -589,7 +604,7 @@ class AudioClip : public Configurable,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auxilliary method used by satisfiesCondition().
|
* Auxilliary method used by setMetadata() and getMetadata().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
separateNameAndNameSpace(const std::string & key,
|
separateNameAndNameSpace(const std::string & key,
|
||||||
|
|
|
@ -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/Playable.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -73,7 +73,7 @@ using namespace boost::posix_time;
|
||||||
* It contains the methods which are common to these classes.
|
* It contains the methods which are common to these classes.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.10 $
|
* @version $Revision: 1.11 $
|
||||||
*/
|
*/
|
||||||
class Playable : public boost::enable_shared_from_this<Playable>
|
class Playable : public boost::enable_shared_from_this<Playable>
|
||||||
{
|
{
|
||||||
|
@ -208,11 +208,14 @@ class Playable : public boost::enable_shared_from_this<Playable>
|
||||||
*
|
*
|
||||||
* @param value the new value of the metadata field.
|
* @param value the new value of the metadata field.
|
||||||
* @param key the name of the metadata field
|
* @param key the name of the metadata field
|
||||||
|
* @exception std::invalid_argument if the key is dcterms:extent,
|
||||||
|
* but the value is not a valid ISO-8601 time
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &key)
|
const std::string &key)
|
||||||
throw () = 0;
|
throw (std::invalid_argument)
|
||||||
|
= 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a partial XML representation of this audio clip or playlist.
|
* Return a partial XML representation of this audio clip or playlist.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.35 $
|
Version : $Revision: 1.36 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -128,7 +128,7 @@ using namespace boost::posix_time;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.35 $
|
* @version $Revision: 1.36 $
|
||||||
*/
|
*/
|
||||||
class Playlist : public Configurable,
|
class Playlist : public Configurable,
|
||||||
public Playable
|
public Playable
|
||||||
|
@ -204,21 +204,34 @@ class Playlist : public Configurable,
|
||||||
* @param value the new value of the metadata field.
|
* @param value the new value of the metadata field.
|
||||||
* @param name the name of the metadata field (without prefix)
|
* @param name the name of the metadata field (without prefix)
|
||||||
* @param prefix the prefix of the metadata field
|
* @param prefix the prefix of the metadata field
|
||||||
|
* @exception std::invalid_argument if the key is dcterms:extent,
|
||||||
|
* but the value is not a valid ISO-8601 time
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &name, const std::string &prefix)
|
const std::string &name, const std::string &prefix)
|
||||||
throw ();
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the total playing length of this playlist.
|
* Set the total playing length of this playlist.
|
||||||
*
|
*
|
||||||
* @param the playing length in microseconds precision.
|
* @param playlength the playing length in microseconds precision.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setPlaylength(Ptr<time_duration>::Ref playlength)
|
setPlaylength(Ptr<time_duration>::Ref playlength)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the playlength member of this audio clip.
|
||||||
|
*
|
||||||
|
* @param timeString the playing length in microseconds precision.
|
||||||
|
* @exception std::invalid_argument if the argument is not
|
||||||
|
* a valid ISO-8601 time
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setPlaylength(const std::string & timeString)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A private iterator type for internal use. It is non-constant;
|
* A private iterator type for internal use. It is non-constant;
|
||||||
* otherwise it is the same as Playlist::const_iterator.
|
* otherwise it is the same as Playlist::const_iterator.
|
||||||
|
@ -679,11 +692,13 @@ class Playlist : public Configurable,
|
||||||
*
|
*
|
||||||
* @param value the new value of the metadata field.
|
* @param value the new value of the metadata field.
|
||||||
* @param key the name of the metadata field
|
* @param key the name of the metadata field
|
||||||
|
* @exception std::invalid_argument if the key is dcterms:extent,
|
||||||
|
* but the value is not a valid ISO-8601 time
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &key)
|
const std::string &key)
|
||||||
throw ();
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: fgerlits $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/XmlRpcInvalidDataException.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_XmlRpcInvalidDataException_h
|
||||||
|
#define LiveSupport_Core_XmlRpcInvalidDataException_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/XmlRpcException.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception signaling an XML-RPC problem: invalid data returned by the method.
|
||||||
|
* This could be a malformed AudioClip or Playlist, for example.
|
||||||
|
*
|
||||||
|
* @author $Author: fgerlits $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class XmlRpcInvalidDataException : public XmlRpcException
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor based on a string.
|
||||||
|
*
|
||||||
|
* @param msg the message of the exception.
|
||||||
|
*/
|
||||||
|
XmlRpcInvalidDataException(const std::string &msg) throw ()
|
||||||
|
: XmlRpcException(msg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor based on a parent exception.
|
||||||
|
*
|
||||||
|
* @param parent the parent exception to this one.
|
||||||
|
*/
|
||||||
|
XmlRpcInvalidDataException(const std::exception & parent)
|
||||||
|
throw ()
|
||||||
|
: XmlRpcException(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor based on a message ant a parent exception.
|
||||||
|
*
|
||||||
|
* @param msg the message of the exception.
|
||||||
|
* @param parent the parent exception.
|
||||||
|
*/
|
||||||
|
XmlRpcInvalidDataException(const std::string & msg,
|
||||||
|
const std::exception & parent)
|
||||||
|
throw ()
|
||||||
|
: XmlRpcException(msg, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual destructor.
|
||||||
|
*/
|
||||||
|
~XmlRpcInvalidDataException(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_XmlRpcInvalidDataException_h
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.29 $
|
Version : $Revision: 1.30 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -215,7 +215,8 @@ AudioClip :: AudioClip(Ptr<UniqueId>::Ref id,
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Constructor without ID.
|
* Constructor without ID.
|
||||||
*----------------------------------------------------------------------------*/AudioClip :: AudioClip(Ptr<const Glib::ustring>::Ref title,
|
*----------------------------------------------------------------------------*/
|
||||||
|
AudioClip :: AudioClip(Ptr<const Glib::ustring>::Ref title,
|
||||||
Ptr<time_duration>::Ref playlength,
|
Ptr<time_duration>::Ref playlength,
|
||||||
Ptr<const std::string>::Ref uri)
|
Ptr<const std::string>::Ref uri)
|
||||||
throw ()
|
throw ()
|
||||||
|
@ -280,6 +281,30 @@ AudioClip :: setTitle(Ptr<const Glib::ustring>::Ref title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set the value of the playlength from a string (private).
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
AudioClip :: setPlaylength(const std::string & timeString)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
playlength.reset(new time_duration(duration_from_string(timeString)));
|
||||||
|
} catch (boost::bad_lexical_cast &e) {
|
||||||
|
std::string eMsg = "bad time format in playlength: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
std::string eMsg = "bad time format in playlength: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
} catch ( ... ) {
|
||||||
|
std::string eMsg = "bad time format in playlength";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create an audio clip object based on an XML element.
|
* Create an audio clip object based on an XML element.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -306,8 +331,6 @@ AudioClip :: configure(const xmlpp::Element & element)
|
||||||
|
|
||||||
if (!playlength
|
if (!playlength
|
||||||
&& (attribute = element.get_attribute(playlengthAttrName))) {
|
&& (attribute = element.get_attribute(playlengthAttrName))) {
|
||||||
playlength.reset(new time_duration(duration_from_string(
|
|
||||||
attribute->get_value() )));
|
|
||||||
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
|
Ptr<const Glib::ustring>::Ref playlengthString(new const Glib::ustring(
|
||||||
attribute->get_value() ));
|
attribute->get_value() ));
|
||||||
setMetadata(playlengthString, extentElementName, extentElementPrefix);
|
setMetadata(playlengthString, extentElementName, extentElementPrefix);
|
||||||
|
@ -357,8 +380,7 @@ AudioClip :: configure(const xmlpp::Element & element)
|
||||||
if (!playlength && prefix == extentElementPrefix
|
if (!playlength && prefix == extentElementPrefix
|
||||||
&& name == extentElementName) {
|
&& name == extentElementName) {
|
||||||
if (dataElement->has_child_text()) {
|
if (dataElement->has_child_text()) {
|
||||||
playlength.reset(new time_duration(duration_from_string(
|
setPlaylength(dataElement->get_child_text()->get_content());
|
||||||
dataElement->get_child_text()->get_content() )));
|
|
||||||
} else { // or just leave blank? bad either way
|
} else { // or just leave blank? bad either way
|
||||||
playlength.reset(new time_duration(0,0,0,0));
|
playlength.reset(new time_duration(0,0,0,0));
|
||||||
}
|
}
|
||||||
|
@ -457,7 +479,7 @@ AudioClip :: getMetadata(const string &key) const
|
||||||
void
|
void
|
||||||
AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &key)
|
const std::string &key)
|
||||||
throw ()
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
std::string name, prefix;
|
std::string name, prefix;
|
||||||
separateNameAndNameSpace(key, name, prefix);
|
separateNameAndNameSpace(key, name, prefix);
|
||||||
|
@ -471,11 +493,10 @@ AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
void
|
void
|
||||||
AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
AudioClip :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &name, const std::string &prefix)
|
const std::string &name, const std::string &prefix)
|
||||||
throw ()
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
if (prefix == extentElementPrefix && name == extentElementName) {
|
if (prefix == extentElementPrefix && name == extentElementName) {
|
||||||
playlength.reset(new time_duration(
|
setPlaylength(*value); // may throw invalid_argument
|
||||||
duration_from_string(*value) ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefix == titleElementPrefix && name == titleElementName) {
|
if (prefix == titleElementPrefix && name == titleElementName) {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.35 $
|
Version : $Revision: 1.36 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -274,6 +274,30 @@ Playlist :: setPlaylength(Ptr<time_duration>::Ref playlength)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Set the value of the playlength from a string (private).
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
Playlist :: setPlaylength(const std::string & timeString)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
playlength.reset(new time_duration(duration_from_string(timeString)));
|
||||||
|
} catch (boost::bad_lexical_cast &e) {
|
||||||
|
std::string eMsg = "bad time format in playlength: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
std::string eMsg = "bad time format in playlength: ";
|
||||||
|
eMsg += e.what();
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
} catch ( ... ) {
|
||||||
|
std::string eMsg = "bad time format in playlength";
|
||||||
|
throw std::invalid_argument(eMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a playlist object based on an XML element.
|
* Create a playlist object based on an XML element.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -300,8 +324,6 @@ Playlist :: configure(const xmlpp::Element & element)
|
||||||
|
|
||||||
if (!playlength
|
if (!playlength
|
||||||
&& (attribute = element.get_attribute(playlengthAttrName))) {
|
&& (attribute = element.get_attribute(playlengthAttrName))) {
|
||||||
playlength.reset(new time_duration(
|
|
||||||
duration_from_string(attribute->get_value())));
|
|
||||||
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
|
Ptr<Glib::ustring>::Ref playlengthString(new Glib::ustring(
|
||||||
attribute->get_value() ));
|
attribute->get_value() ));
|
||||||
setMetadata(playlengthString, extentElementName, extentElementPrefix);
|
setMetadata(playlengthString, extentElementName, extentElementPrefix);
|
||||||
|
@ -358,8 +380,7 @@ Playlist :: configure(const xmlpp::Element & element)
|
||||||
if (!playlength && prefix == extentElementPrefix
|
if (!playlength && prefix == extentElementPrefix
|
||||||
&& name == extentElementName) {
|
&& name == extentElementName) {
|
||||||
if (dataElement->has_child_text()) {
|
if (dataElement->has_child_text()) {
|
||||||
playlength.reset(new time_duration(duration_from_string(
|
setPlaylength(dataElement->get_child_text()->get_content());
|
||||||
dataElement->get_child_text()->get_content() )));
|
|
||||||
} else { // or just leave blank? bad either way
|
} else { // or just leave blank? bad either way
|
||||||
playlength.reset(new time_duration(0,0,0,0));
|
playlength.reset(new time_duration(0,0,0,0));
|
||||||
}
|
}
|
||||||
|
@ -641,7 +662,7 @@ Playlist :: getMetadata(const string &key) const
|
||||||
void
|
void
|
||||||
Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &key)
|
const std::string &key)
|
||||||
throw ()
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
std::string name, prefix;
|
std::string name, prefix;
|
||||||
separateNameAndNameSpace(key, name, prefix);
|
separateNameAndNameSpace(key, name, prefix);
|
||||||
|
@ -655,11 +676,10 @@ Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
void
|
void
|
||||||
Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
Playlist :: setMetadata(Ptr<const Glib::ustring>::Ref value,
|
||||||
const std::string &name, const std::string &prefix)
|
const std::string &name, const std::string &prefix)
|
||||||
throw ()
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
if (prefix == extentElementPrefix && name == extentElementName) {
|
if (prefix == extentElementPrefix && name == extentElementName) {
|
||||||
playlength.reset(new time_duration(
|
setPlaylength(*value);
|
||||||
duration_from_string(*value) ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefix == titleElementPrefix && name == titleElementName) {
|
if (prefix == titleElementPrefix && name == titleElementName) {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.42 $
|
Version : $Revision: 1.43 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
#include "LiveSupport/Core/XmlRpcMethodResponseException.h"
|
#include "LiveSupport/Core/XmlRpcMethodResponseException.h"
|
||||||
#include "LiveSupport/Core/XmlRpcInvalidArgumentException.h"
|
#include "LiveSupport/Core/XmlRpcInvalidArgumentException.h"
|
||||||
#include "LiveSupport/Core/XmlRpcIOException.h"
|
#include "LiveSupport/Core/XmlRpcIOException.h"
|
||||||
|
#include "LiveSupport/Core/XmlRpcInvalidDataException.h"
|
||||||
#include "WebStorageClient.h"
|
#include "WebStorageClient.h"
|
||||||
|
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
|
@ -914,10 +915,10 @@ WebStorageClient :: getPlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
playlist->configure(*root);
|
playlist->configure(*root);
|
||||||
|
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
throw XmlRpcMethodResponseException(
|
throw XmlRpcInvalidDataException(
|
||||||
"semantic error in playlist metafile");
|
"semantic error in playlist metafile");
|
||||||
} catch (xmlpp::exception &e) {
|
} catch (xmlpp::exception &e) {
|
||||||
throw XmlRpcMethodResponseException(
|
throw XmlRpcInvalidDataException(
|
||||||
"error parsing playlist metafile");
|
"error parsing playlist metafile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1410,11 +1411,11 @@ WebStorageClient :: getAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
std::string eMsg = "semantic error in audio clip metafile:\n";
|
std::string eMsg = "semantic error in audio clip metafile:\n";
|
||||||
eMsg += e.what();
|
eMsg += e.what();
|
||||||
throw XmlRpcMethodResponseException(eMsg);
|
throw XmlRpcInvalidDataException(eMsg);
|
||||||
} catch (xmlpp::exception &e) {
|
} catch (xmlpp::exception &e) {
|
||||||
std::string eMsg = "error parsing audio clip metafile";
|
std::string eMsg = "error parsing audio clip metafile";
|
||||||
eMsg += e.what();
|
eMsg += e.what();
|
||||||
throw XmlRpcMethodResponseException(eMsg);
|
throw XmlRpcInvalidDataException(eMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters.clear();
|
parameters.clear();
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.29 $
|
Version : $Revision: 1.30 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -96,7 +96,7 @@ using namespace LiveSupport::Core;
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.29 $
|
* @version $Revision: 1.30 $
|
||||||
*/
|
*/
|
||||||
class WebStorageClient :
|
class WebStorageClient :
|
||||||
virtual public Configurable,
|
virtual public Configurable,
|
||||||
|
@ -258,9 +258,10 @@ class WebStorageClient :
|
||||||
* @param sessionId the session ID from the authentication client
|
* @param sessionId the session ID from the authentication client
|
||||||
* @param id the id of the playlist to return.
|
* @param id the id of the playlist to return.
|
||||||
* @return the requested playlist.
|
* @return the requested playlist.
|
||||||
|
* @exception XmlRpcInvalidDataException if the audio clip we got
|
||||||
|
* from the storage is invalid.
|
||||||
* @exception XmlRpcException if there is a problem with the XML-RPC
|
* @exception XmlRpcException if there is a problem with the XML-RPC
|
||||||
* call or no playlist with the specified
|
* call or no playlist with the specified id exists.
|
||||||
* id exists.
|
|
||||||
*/
|
*/
|
||||||
virtual Ptr<Playlist>::Ref
|
virtual Ptr<Playlist>::Ref
|
||||||
getPlaylist(Ptr<SessionId>::Ref sessionId,
|
getPlaylist(Ptr<SessionId>::Ref sessionId,
|
||||||
|
@ -379,9 +380,10 @@ class WebStorageClient :
|
||||||
* @param sessionId the session ID from the authentication client
|
* @param sessionId the session ID from the authentication client
|
||||||
* @param id the id of the audio clip to return.
|
* @param id the id of the audio clip to return.
|
||||||
* @return the requested audio clip.
|
* @return the requested audio clip.
|
||||||
|
* @exception XmlRpcInvalidDataException if the audio clip we got
|
||||||
|
* from the storage is invalid.
|
||||||
* @exception XmlRpcException if there is a problem with the XML-RPC
|
* @exception XmlRpcException if there is a problem with the XML-RPC
|
||||||
* call or no audio clip with the
|
* call or no audio clip with the specified id exists.
|
||||||
* specified id exists.
|
|
||||||
*/
|
*/
|
||||||
virtual Ptr<AudioClip>::Ref
|
virtual Ptr<AudioClip>::Ref
|
||||||
getAudioClip(Ptr<SessionId>::Ref sessionId,
|
getAudioClip(Ptr<SessionId>::Ref sessionId,
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.51 $
|
Version : $Revision: 1.52 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
#include "LiveSupport/SchedulerClient/SchedulerClientFactory.h"
|
#include "LiveSupport/SchedulerClient/SchedulerClientFactory.h"
|
||||||
#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
|
#include "LiveSupport/PlaylistExecutor/AudioPlayerFactory.h"
|
||||||
#include "LiveSupport/Core/TimeConversion.h"
|
#include "LiveSupport/Core/TimeConversion.h"
|
||||||
|
#include "LiveSupport/Core/XmlRpcInvalidDataException.h"
|
||||||
|
|
||||||
#include "MasterPanelWindow.h"
|
#include "MasterPanelWindow.h"
|
||||||
#include "GLiveSupport.h"
|
#include "GLiveSupport.h"
|
||||||
|
@ -1029,13 +1030,27 @@ GLiveSupport :: search(Ptr<SearchCriteria>::Ref criteria)
|
||||||
audioClipIds = storage->getAudioClipIds();
|
audioClipIds = storage->getAudioClipIds();
|
||||||
std::vector<Ptr<UniqueId>::Ref>::const_iterator it;
|
std::vector<Ptr<UniqueId>::Ref>::const_iterator it;
|
||||||
for (it = audioClipIds->begin(); it != audioClipIds->end(); ++it) {
|
for (it = audioClipIds->begin(); it != audioClipIds->end(); ++it) {
|
||||||
results->push_back(storage->getAudioClip(sessionId, *it));
|
try {
|
||||||
|
Ptr<AudioClip>::Ref audioClip
|
||||||
|
= storage->getAudioClip(sessionId, *it);
|
||||||
|
results->push_back(audioClip);
|
||||||
|
} catch (XmlRpcInvalidDataException &e) {
|
||||||
|
std::cerr << "invalid audio clip in search(): " << e.what()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref
|
Ptr<std::vector<Ptr<UniqueId>::Ref> >::Ref
|
||||||
playlistIds = storage->getPlaylistIds();
|
playlistIds = storage->getPlaylistIds();
|
||||||
for (it = playlistIds->begin(); it != playlistIds->end(); ++it) {
|
for (it = playlistIds->begin(); it != playlistIds->end(); ++it) {
|
||||||
results->push_back(storage->getPlaylist(sessionId, *it));
|
try {
|
||||||
|
Ptr<Playlist>::Ref playlist
|
||||||
|
= storage->getPlaylist(sessionId, *it);
|
||||||
|
results->push_back(playlist);
|
||||||
|
} catch (XmlRpcInvalidDataException &e) {
|
||||||
|
std::cerr << "invalid playlist in search(): " << e.what()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
|
|
Loading…
Reference in New Issue