adding more metadata checking stuff; this fixes #1802
This commit is contained in:
parent
df89686c16
commit
0bab7b928a
|
@ -143,7 +143,9 @@ CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
||||||
${TMP_DIR}/FileTools.o \
|
${TMP_DIR}/FileTools.o \
|
||||||
${TMP_DIR}/AsyncState.o \
|
${TMP_DIR}/AsyncState.o \
|
||||||
${TMP_DIR}/MetadataConstraint.o \
|
${TMP_DIR}/MetadataConstraint.o \
|
||||||
${TMP_DIR}/NumericConstraint.o
|
${TMP_DIR}/NumericConstraint.o \
|
||||||
|
${TMP_DIR}/NumericRangeConstraint.o \
|
||||||
|
${TMP_DIR}/EnumerationConstraint.o
|
||||||
|
|
||||||
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
||||||
${TMP_DIR}/FileToolsTest.o \
|
${TMP_DIR}/FileToolsTest.o \
|
||||||
|
|
|
@ -12,153 +12,201 @@
|
||||||
<!ELEMENT constraint (value*) >
|
<!ELEMENT constraint (value*) >
|
||||||
<!ATTLIST constraint type NMTOKEN #REQUIRED >
|
<!ATTLIST constraint type NMTOKEN #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT value (CDATA) >
|
<!ELEMENT value (#PCDATA) >
|
||||||
|
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<metadataTypeContainer>
|
<metadataTypeContainer>
|
||||||
<metadataType dcName = "dc:title"
|
<metadataType dcName = "dc:title"
|
||||||
id3Tag = "TIT2"
|
id3Tag = "TIT2"
|
||||||
localizationKey = "title"
|
localizationKey = "title"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:creator"
|
<metadataType dcName = "dc:creator"
|
||||||
id3Tag = "TPE1"
|
id3Tag = "TPE1"
|
||||||
localizationKey = "creator"
|
localizationKey = "creator"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:source"
|
<metadataType dcName = "dc:source"
|
||||||
id3Tag = "TALB"
|
id3Tag = "TALB"
|
||||||
localizationKey = "album"
|
localizationKey = "album"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:year"
|
<metadataType dcName = "ls:year"
|
||||||
id3Tag = "TYER"
|
id3Tag = "TYER"
|
||||||
localizationKey = "year" >
|
localizationKey = "year"
|
||||||
<constraint type = "numeric" />
|
tab = "music" >
|
||||||
|
<constraint type = "numericRange" >
|
||||||
|
<value>0</value>
|
||||||
|
<value>3000</value>
|
||||||
|
</constraint>
|
||||||
</metadataType>
|
</metadataType>
|
||||||
<metadataType dcName = "dc:type"
|
<metadataType dcName = "dc:type"
|
||||||
id3Tag = "TCON"
|
id3Tag = "TCON"
|
||||||
localizationKey = "genre"
|
localizationKey = "genre"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:description"
|
<metadataType dcName = "dc:description"
|
||||||
id3Tag = "COMM"
|
id3Tag = "COMM"
|
||||||
localizationKey = "description"
|
localizationKey = "description"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:format"
|
<metadataType dcName = "dc:format"
|
||||||
localizationKey = "format"
|
localizationKey = "format" >
|
||||||
/>
|
<constraint type = "enumeration" >
|
||||||
<metadataType dcName = "ls:bpm"
|
<value>mp3</value>
|
||||||
id3Tag = "TBPM"
|
<value>mpeg</value>
|
||||||
localizationKey = "bpm" >
|
<value>ogg</value>
|
||||||
<constraint type = "numeric" />
|
</constraint>
|
||||||
</metadataType>
|
</metadataType>
|
||||||
<metadataType dcName = "ls:rating"
|
<metadataType dcName = "ls:bpm"
|
||||||
id3Tag = "POPM"
|
id3Tag = "TBPM"
|
||||||
localizationKey = "rating"
|
localizationKey = "bpm"
|
||||||
/>
|
tab = "music" >
|
||||||
<metadataType dcName = "dcterms:extent"
|
<constraint type = "numeric" />
|
||||||
localizationKey = "length"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:encoded_by"
|
|
||||||
id3Tag = "TENC"
|
|
||||||
localizationKey = "encoded_by"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:track_num"
|
|
||||||
id3Tag = "TRCK"
|
|
||||||
localizationKey = "track_number" >
|
|
||||||
<constraint type = "numeric" />
|
|
||||||
</metadataType>
|
</metadataType>
|
||||||
<metadataType dcName = "ls:disc_num"
|
<metadataType dcName = "ls:rating"
|
||||||
id3Tag = "TPOS"
|
id3Tag = "POPM"
|
||||||
localizationKey = "disc_number" >
|
localizationKey = "rating"
|
||||||
<constraint type = "numeric" />
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dcterms:extent"
|
||||||
|
localizationKey = "length"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "ls:encoded_by"
|
||||||
|
id3Tag = "TENC"
|
||||||
|
localizationKey = "encoded_by"
|
||||||
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "ls:track_num"
|
||||||
|
id3Tag = "TRCK"
|
||||||
|
localizationKey = "track_number"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
</metadataType>
|
</metadataType>
|
||||||
<metadataType dcName = "ls:mood"
|
<metadataType dcName = "ls:disc_num"
|
||||||
id3Tag = "TMOO"
|
id3Tag = "TPOS"
|
||||||
localizationKey = "mood"
|
localizationKey = "disc_number"
|
||||||
/>
|
tab = "music" >
|
||||||
<metadataType dcName = "dc:publisher"
|
<constraint type = "numeric" />
|
||||||
id3Tag = "TPUB"
|
|
||||||
localizationKey = "publishing_label"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:composer"
|
|
||||||
id3Tag = "TCOM"
|
|
||||||
localizationKey = "composer"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:bitrate"
|
|
||||||
localizationKey = "bitrate"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:channels"
|
|
||||||
localizationKey = "channels" >
|
|
||||||
<constraint type = "numeric" />
|
|
||||||
</metadataType>
|
</metadataType>
|
||||||
<metadataType dcName = "ls:samplerate"
|
<metadataType dcName = "ls:mood"
|
||||||
localizationKey = "sample_rate" >
|
id3Tag = "TMOO"
|
||||||
<constraint type = "numeric" />
|
localizationKey = "mood"
|
||||||
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dc:publisher"
|
||||||
|
id3Tag = "TPUB"
|
||||||
|
localizationKey = "publishing_label"
|
||||||
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "ls:composer"
|
||||||
|
id3Tag = "TCOM"
|
||||||
|
localizationKey = "composer"
|
||||||
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "ls:bitrate"
|
||||||
|
localizationKey = "bitrate"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
</metadataType>
|
</metadataType>
|
||||||
<metadataType dcName = "ls:encoder"
|
<metadataType dcName = "ls:channels"
|
||||||
id3Tag = "TSSE"
|
localizationKey = "channels"
|
||||||
localizationKey = "encoding_software"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:crc"
|
<metadataType dcName = "ls:samplerate"
|
||||||
localizationKey = "checksum"
|
localizationKey = "sample_rate"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:encoder"
|
||||||
|
id3Tag = "TSSE"
|
||||||
|
localizationKey = "encoding_software"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyrics"
|
<metadataType dcName = "ls:crc"
|
||||||
localizationKey = "lyrics"
|
localizationKey = "checksum"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:orchestra"
|
<metadataType dcName = "ls:lyrics"
|
||||||
id3Tag = "TPE2"
|
localizationKey = "lyrics"
|
||||||
localizationKey = "orchestra_or_band"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:conductor"
|
<metadataType dcName = "ls:orchestra"
|
||||||
id3Tag = "TPE3"
|
id3Tag = "TPE2"
|
||||||
localizationKey = "conductor"
|
localizationKey = "orchestra_or_band"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyricist"
|
<metadataType dcName = "ls:conductor"
|
||||||
id3Tag = "TEXT"
|
id3Tag = "TPE3"
|
||||||
localizationKey = "lyricist"
|
localizationKey = "conductor"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:originallyricist"
|
<metadataType dcName = "ls:lyricist"
|
||||||
id3Tag = "TOLY"
|
id3Tag = "TEXT"
|
||||||
localizationKey = "original_lyricist"
|
localizationKey = "lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationname"
|
<metadataType dcName = "ls:originallyricist"
|
||||||
id3Tag = "TRSN"
|
id3Tag = "TOLY"
|
||||||
localizationKey = "radio_station_name"
|
localizationKey = "original_lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiofileinfourl"
|
<metadataType dcName = "ls:radiostationname"
|
||||||
id3Tag = "WOAF"
|
id3Tag = "TRSN"
|
||||||
localizationKey = "audio_file_info_url"
|
localizationKey = "radio_station_name"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:artisturl"
|
<metadataType dcName = "ls:audiofileinfourl"
|
||||||
id3Tag = "WOAR"
|
id3Tag = "WOAF"
|
||||||
localizationKey = "artist_url"
|
localizationKey = "audio_file_info_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiosourceurl"
|
<metadataType dcName = "ls:artisturl"
|
||||||
id3Tag = "WOAS"
|
id3Tag = "WOAR"
|
||||||
localizationKey = "audio_source_url"
|
localizationKey = "artist_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationurl"
|
<metadataType dcName = "ls:audiosourceurl"
|
||||||
id3Tag = "WORS"
|
id3Tag = "WOAS"
|
||||||
localizationKey = "radio_station_url"
|
localizationKey = "audio_source_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:buycdurl"
|
<metadataType dcName = "ls:radiostationurl"
|
||||||
id3Tag = "WPAY"
|
id3Tag = "WORS"
|
||||||
localizationKey = "buy_cd_url"
|
localizationKey = "radio_station_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:isrcnumber"
|
<metadataType dcName = "ls:buycdurl"
|
||||||
id3Tag = "TSRC"
|
id3Tag = "WPAY"
|
||||||
localizationKey = "isrc_number"
|
localizationKey = "buy_cd_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:catalognumber"
|
<metadataType dcName = "ls:isrcnumber"
|
||||||
localizationKey = "catalog_number"
|
id3Tag = "TSRC"
|
||||||
|
localizationKey = "isrc_number"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:originalartist"
|
<metadataType dcName = "ls:catalognumber"
|
||||||
id3Tag = "TOPE"
|
localizationKey = "catalog_number"
|
||||||
localizationKey = "original_artist"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:rights"
|
<metadataType dcName = "ls:originalartist"
|
||||||
id3Tag = "TCOP"
|
id3Tag = "TOPE"
|
||||||
localizationKey = "copyright"
|
localizationKey = "original_artist"
|
||||||
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dc:rights"
|
||||||
|
id3Tag = "TCOP"
|
||||||
|
localizationKey = "copyright"
|
||||||
|
tab = "music"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dcterms:temporal"
|
||||||
|
localizationKey = "report_date_time"
|
||||||
|
tab = "voice"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dcterms:spatial"
|
||||||
|
localizationKey = "report_location"
|
||||||
|
tab = "voice"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dcterms:entity"
|
||||||
|
localizationKey = "report_organizations"
|
||||||
|
tab = "voice"
|
||||||
|
/>
|
||||||
|
<metadataType dcName = "dc:subject"
|
||||||
|
localizationKey = "subject"
|
||||||
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
|
|
@ -248,15 +248,15 @@ class MetadataTypeContainer : public Configurable,
|
||||||
* If the metadata type has no constraints, it returns true.
|
* If the metadata type has no constraints, it returns true.
|
||||||
* If the constraint throws an exception, it returns false.
|
* If the constraint throws an exception, it returns false.
|
||||||
*
|
*
|
||||||
* @param dcName the metadata type, by its Dublin Core name.
|
|
||||||
* @param value the value to be checked against the constraint.
|
* @param value the value to be checked against the constraint.
|
||||||
|
* @param dcName the metadata type, by its Dublin Core name.
|
||||||
* @return true if the value satisfies the constraint.
|
* @return true if the value satisfies the constraint.
|
||||||
* @exception std::invalid_argument if no metadata type exists
|
* @exception std::invalid_argument if no metadata type exists
|
||||||
* with the suplied name.
|
* with the suplied name.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
check(const Glib::ustring & dcName,
|
check(Ptr<const Glib::ustring>::Ref value,
|
||||||
Ptr<const Glib::ustring>::Ref value)
|
const Glib::ustring & dcName)
|
||||||
throw (std::invalid_argument);
|
throw (std::invalid_argument);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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$
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL$
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include "EnumerationConstraint.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The value of the type attribute for this class.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string typeAttributeValue = "enumeration";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Create a constraint element object based on an XML element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
EnumerationConstraint :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (element.get_name() != getConfigElementName()) {
|
||||||
|
throw std::invalid_argument("bad configuration element "
|
||||||
|
+ element.get_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Attribute* typeAttribute;
|
||||||
|
if (!(typeAttribute = element.get_attribute(typeAttributeName))) {
|
||||||
|
throw std::invalid_argument("missing attribute " + typeAttributeName);
|
||||||
|
}
|
||||||
|
std::string type = typeAttribute->get_value();
|
||||||
|
|
||||||
|
if (type != typeAttributeValue) {
|
||||||
|
throw std::invalid_argument(typeAttributeValue
|
||||||
|
+ " constraint configured with a"
|
||||||
|
+ " constraint element of type "
|
||||||
|
+ type);
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlpp::Node::NodeList childNodes = element.get_children(valueElementName);
|
||||||
|
xmlpp::Node::NodeList::iterator it = childNodes.begin();
|
||||||
|
|
||||||
|
if (it == childNodes.end()) {
|
||||||
|
throw std::invalid_argument("empty enumeration constraint");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; it != childNodes.end(); ++it) {
|
||||||
|
readValue(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Read an enumeration value from an XML node.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
EnumerationConstraint :: readValue(const xmlpp::Node * node)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
const xmlpp::Element * valueElement
|
||||||
|
= dynamic_cast<const xmlpp::Element*> (node);
|
||||||
|
if (valueElement) {
|
||||||
|
allowedValues.push_back(valueElement->get_child_text()
|
||||||
|
->get_content() );
|
||||||
|
} else {
|
||||||
|
throw std::invalid_argument("bad sub-element found in constraint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Check that the given value satisfies the constraint.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
bool
|
||||||
|
EnumerationConstraint :: check(Ptr<const Glib::ustring>::Ref value) const
|
||||||
|
throw (std::logic_error)
|
||||||
|
{
|
||||||
|
if (!value) {
|
||||||
|
throw std::logic_error("EnumerationConstraint::check() called with "
|
||||||
|
"a 0 pointer value");
|
||||||
|
}
|
||||||
|
|
||||||
|
ListType::const_iterator it;
|
||||||
|
for (it = allowedValues.begin(); it != allowedValues.end(); ++it) {
|
||||||
|
if (*it == *value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,174 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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$
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL$
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_EnumerationConstraint_h
|
||||||
|
#define LiveSupport_Core_EnumerationConstraint_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/MetadataConstraint.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class for representing a metadata constraint allowing only strings from
|
||||||
|
* a given list of values.
|
||||||
|
*
|
||||||
|
* This is a concrete subclass of MetadataConstraint. Do not explicitly
|
||||||
|
* instantiate this class; create a MetadataConstraint object instead, and
|
||||||
|
* configure it with an XML element with the appropriate type attribute.
|
||||||
|
*
|
||||||
|
* This object has to be configured with an XML configuration element
|
||||||
|
* called constraint. This may look like the following:
|
||||||
|
*
|
||||||
|
* <pre><code>
|
||||||
|
* <constraint type = "enumeration">
|
||||||
|
* <value>Monday</value>
|
||||||
|
* ...
|
||||||
|
* <value>Sunday</value>
|
||||||
|
* </constraint>
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* A metadata type with this kind of constraint can only accept one of the
|
||||||
|
* strings listed in the value elements (in a case-sensitive way).
|
||||||
|
*
|
||||||
|
* The DTD for the expected XML element looks like the following:
|
||||||
|
*
|
||||||
|
* <pre><code>
|
||||||
|
* <!ELEMENT constraint (value+) >
|
||||||
|
* <!ATTLIST constraint type "enumeration" #FIXED >
|
||||||
|
* <!ELEMENT value (#PCDATA) >
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
* @see EnumerationConstraintContainer
|
||||||
|
*/
|
||||||
|
class EnumerationConstraint : public MetadataConstraint
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The type for storing the enumeration values.
|
||||||
|
*/
|
||||||
|
typedef std::vector<Glib::ustring> ListType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of allowed enumeration values.
|
||||||
|
*/
|
||||||
|
ListType allowedValues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read an enumeration value from an XML node.
|
||||||
|
*
|
||||||
|
* @param node the node containing the value.
|
||||||
|
* @exception std::invalid_argument if the XML node is not
|
||||||
|
* of the expected form.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
readValue(const xmlpp::Node * node) throw (std::invalid_argument);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
EnumerationConstraint() throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~EnumerationConstraint(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return MetadataConstraint::getConfigElementName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the metadata object based on an XML configuration element.
|
||||||
|
*
|
||||||
|
* @param elemen the XML configuration element.
|
||||||
|
* @exception std::invalid_argument of the supplied XML element
|
||||||
|
* contains bad configuration information
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element &element)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that the given value satisfies the constraint.
|
||||||
|
*
|
||||||
|
* @param value the value to be checked against the constraint.
|
||||||
|
* @return true if the value satisfies the constraint.
|
||||||
|
* @exception std::logic_error if the parameter is a 0 pointer.
|
||||||
|
*/
|
||||||
|
virtual bool
|
||||||
|
check(Ptr<const Glib::ustring>::Ref value) const
|
||||||
|
throw (std::logic_error);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_EnumerationConstraint_h
|
||||||
|
|
|
@ -29,8 +29,11 @@
|
||||||
|
|
||||||
/* ============================================================ include files */
|
/* ============================================================ include files */
|
||||||
|
|
||||||
#include "LiveSupport/Core/MetadataConstraint.h"
|
|
||||||
#include "NumericConstraint.h"
|
#include "NumericConstraint.h"
|
||||||
|
#include "NumericRangeConstraint.h"
|
||||||
|
#include "EnumerationConstraint.h"
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/MetadataConstraint.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace LiveSupport::Core;
|
using namespace LiveSupport::Core;
|
||||||
|
@ -83,6 +86,14 @@ MetadataConstraint :: configure(const xmlpp::Element & element)
|
||||||
concreteConstraint.reset(new NumericConstraint());
|
concreteConstraint.reset(new NumericConstraint());
|
||||||
concreteConstraint->configure(element);
|
concreteConstraint->configure(element);
|
||||||
|
|
||||||
|
} else if (type == "numericRange") {
|
||||||
|
concreteConstraint.reset(new NumericRangeConstraint());
|
||||||
|
concreteConstraint->configure(element);
|
||||||
|
|
||||||
|
} else if (type == "enumeration") {
|
||||||
|
concreteConstraint.reset(new EnumerationConstraint());
|
||||||
|
concreteConstraint->configure(element);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw std::invalid_argument("unknown metadata constraint" + type);
|
throw std::invalid_argument("unknown metadata constraint" + type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,8 +161,8 @@ MetadataTypeContainer :: getById3Tag(const Glib::ustring id3Tag)
|
||||||
* Check that the given value satisfies the constraint of a metadata type.
|
* Check that the given value satisfies the constraint of a metadata type.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
bool
|
bool
|
||||||
MetadataTypeContainer :: check(const Glib::ustring & dcName,
|
MetadataTypeContainer :: check(Ptr<const Glib::ustring>::Ref value,
|
||||||
Ptr<const Glib::ustring>::Ref value)
|
const Glib::ustring & dcName)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
Ptr<const MetadataType>::Ref metadataType = getByDcName(dcName);
|
Ptr<const MetadataType>::Ref metadataType = getByDcName(dcName);
|
||||||
|
|
|
@ -314,16 +314,30 @@ MetadataTypeContainerTest :: constraintTest(void)
|
||||||
{
|
{
|
||||||
// test the case of no constraint; everything is OK
|
// test the case of no constraint; everything is OK
|
||||||
Ptr<Glib::ustring>::Ref title;
|
Ptr<Glib::ustring>::Ref title;
|
||||||
CPPUNIT_ASSERT(!container->check("dc:title", title)); // except a 0 pointer
|
CPPUNIT_ASSERT(!container->check(title, "dc:title")); // except a 0 pointer
|
||||||
title.reset(new Glib::ustring("Some title"));
|
title.reset(new Glib::ustring("Some title"));
|
||||||
CPPUNIT_ASSERT(container->check("dc:title", title));
|
CPPUNIT_ASSERT(container->check(title, "dc:title"));
|
||||||
|
|
||||||
// test the numeric constraint; [0-9]+ required
|
// test the numeric constraint; [0-9]+ required
|
||||||
|
Ptr<Glib::ustring>::Ref bpm(new Glib::ustring ("1000"));
|
||||||
|
CPPUNIT_ASSERT(container->check(bpm, "ls:bpm"));
|
||||||
|
bpm->assign("2000 or more");
|
||||||
|
CPPUNIT_ASSERT(!container->check(bpm, "ls:bpm"));
|
||||||
|
bpm->assign("");
|
||||||
|
CPPUNIT_ASSERT(!container->check(bpm, "ls:bpm"));
|
||||||
|
|
||||||
|
// test the numeric range constraint; [0-9]+ required, between 0 and 3000
|
||||||
Ptr<Glib::ustring>::Ref year(new Glib::ustring ("1000"));
|
Ptr<Glib::ustring>::Ref year(new Glib::ustring ("1000"));
|
||||||
CPPUNIT_ASSERT(container->check("ls:bpm", year));
|
CPPUNIT_ASSERT(container->check(year, "ls:year"));
|
||||||
year->assign("2000 or more");
|
year->assign("1066 AD");
|
||||||
CPPUNIT_ASSERT(!container->check("ls:bpm", year));
|
CPPUNIT_ASSERT(!container->check(year, "ls:year"));
|
||||||
year->assign("");
|
year->assign("20066");
|
||||||
CPPUNIT_ASSERT(!container->check("ls:bpm", year));
|
CPPUNIT_ASSERT(!container->check(year, "ls:year"));
|
||||||
|
|
||||||
|
// test the enumeration constraint; "mp3", "mpeg" or "ogg" are allowed
|
||||||
|
Ptr<Glib::ustring>::Ref format(new Glib::ustring ("mp3"));
|
||||||
|
CPPUNIT_ASSERT(container->check(format, "dc:format"));
|
||||||
|
format->assign("wma");
|
||||||
|
CPPUNIT_ASSERT(!container->check(format, "dc:format"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ using namespace LiveSupport::Core;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* The value of the type attribute for this class
|
* The value of the type attribute for this class.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
const std::string typeAttributeValue = "numeric";
|
const std::string typeAttributeValue = "numeric";
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void
|
||||||
NumericConstraint :: configure(const xmlpp::Element & element)
|
NumericConstraint :: configure(const xmlpp::Element & element)
|
||||||
throw (std::invalid_argument)
|
throw (std::invalid_argument)
|
||||||
{
|
{
|
||||||
if (element.get_name() != MetadataConstraint::getConfigElementName()) {
|
if (element.get_name() != getConfigElementName()) {
|
||||||
throw std::invalid_argument("bad configuration element "
|
throw std::invalid_argument("bad configuration element "
|
||||||
+ element.get_name());
|
+ element.get_name());
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,10 @@ NumericConstraint :: configure(const xmlpp::Element & element)
|
||||||
std::string type = typeAttribute->get_value();
|
std::string type = typeAttribute->get_value();
|
||||||
|
|
||||||
if (type != typeAttributeValue) {
|
if (type != typeAttributeValue) {
|
||||||
throw std::invalid_argument("numeric constraint configured with a "
|
throw std::invalid_argument(typeAttributeValue
|
||||||
"constraint element of type " + type);
|
+ " constraint configured with a"
|
||||||
|
+ " constraint element of type "
|
||||||
|
+ type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@ namespace Core {
|
||||||
/**
|
/**
|
||||||
* A class for representing a numeric metadata constraint.
|
* A class for representing a numeric metadata constraint.
|
||||||
*
|
*
|
||||||
* This is a concrete subclass of NumericConstraint. Do not explicitly
|
* This is a concrete subclass of MetadataConstraint. Do not explicitly
|
||||||
* instantiate this class; create a NumericConstraint object instead, and
|
* instantiate this class; create a MetadataConstraint object instead, and
|
||||||
* configure it with an XML element with the appropriate type attribute.
|
* configure it with an XML element with the appropriate type attribute.
|
||||||
*
|
*
|
||||||
* This object has to be configured with an XML configuration element
|
* This object has to be configured with an XML configuration element
|
||||||
|
@ -81,13 +81,6 @@ namespace Core {
|
||||||
*/
|
*/
|
||||||
class NumericConstraint : public MetadataConstraint
|
class NumericConstraint : public MetadataConstraint
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* The name of the configuration XML element used by NumericConstraint.
|
|
||||||
*/
|
|
||||||
static const std::string configElementNameStr;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -113,7 +106,7 @@ class NumericConstraint : public MetadataConstraint
|
||||||
static const std::string
|
static const std::string
|
||||||
getConfigElementName(void) throw ()
|
getConfigElementName(void) throw ()
|
||||||
{
|
{
|
||||||
return configElementNameStr;
|
return MetadataConstraint::getConfigElementName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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$
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL$
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "NumericConstraint.h"
|
||||||
|
|
||||||
|
#include "NumericRangeConstraint.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The value of the type attribute for this class.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string typeAttributeValue = "numericRange";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Create a constraint element object based on an XML element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
NumericRangeConstraint :: configure(const xmlpp::Element & element)
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
if (element.get_name() != getConfigElementName()) {
|
||||||
|
throw std::invalid_argument("bad configuration element "
|
||||||
|
+ element.get_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
const xmlpp::Attribute* typeAttribute;
|
||||||
|
if (!(typeAttribute = element.get_attribute(typeAttributeName))) {
|
||||||
|
throw std::invalid_argument("missing attribute " + typeAttributeName);
|
||||||
|
}
|
||||||
|
std::string type = typeAttribute->get_value();
|
||||||
|
|
||||||
|
if (type != typeAttributeValue) {
|
||||||
|
throw std::invalid_argument(typeAttributeValue
|
||||||
|
+ " constraint configured with a"
|
||||||
|
+ " constraint element of type "
|
||||||
|
+ type);
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlpp::Node::NodeList childNodes = element.get_children(valueElementName);
|
||||||
|
xmlpp::Node::NodeList::iterator it = childNodes.begin();
|
||||||
|
|
||||||
|
if (it != childNodes.end()) {
|
||||||
|
minValue = readNumberFromNode(*it);
|
||||||
|
} else {
|
||||||
|
throw std::invalid_argument("sub-element not found in constraint");
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
if (it != childNodes.end()) {
|
||||||
|
maxValue = readNumberFromNode(*it);
|
||||||
|
} else {
|
||||||
|
throw std::invalid_argument("sub-element not found in constraint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Read a number from an xml element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
NumericRangeConstraint :: ValueType
|
||||||
|
NumericRangeConstraint :: readNumberFromNode(
|
||||||
|
const xmlpp::Node * node) const
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
const xmlpp::Element * valueElement
|
||||||
|
= dynamic_cast<const xmlpp::Element*> (node);
|
||||||
|
if (valueElement) {
|
||||||
|
Ptr<Glib::ustring>::Ref value(new Glib::ustring(
|
||||||
|
valueElement->get_child_text()
|
||||||
|
->get_content() ));
|
||||||
|
return readNumber(value);
|
||||||
|
} else {
|
||||||
|
throw std::invalid_argument("bad sub-element found in constraint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Read a number from a string.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
NumericRangeConstraint :: ValueType
|
||||||
|
NumericRangeConstraint :: readNumber(
|
||||||
|
Ptr<const Glib::ustring>::Ref value) const
|
||||||
|
throw (std::invalid_argument)
|
||||||
|
{
|
||||||
|
NumericConstraint numericConstraint;
|
||||||
|
if (!numericConstraint.check(value)) {
|
||||||
|
throw std::invalid_argument("bad number found in constraint");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::istringstream valueStream(*value);
|
||||||
|
ValueType valueNumber;
|
||||||
|
valueStream >> valueNumber;
|
||||||
|
|
||||||
|
return valueNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Check that the given value satisfies the constraint.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
bool
|
||||||
|
NumericRangeConstraint :: check(Ptr<const Glib::ustring>::Ref value) const
|
||||||
|
throw (std::logic_error)
|
||||||
|
{
|
||||||
|
ValueType valueNumber = readNumber(value);
|
||||||
|
|
||||||
|
if (valueNumber >= minValue && valueNumber <= maxValue) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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$
|
||||||
|
Version : $Revision$
|
||||||
|
Location : $URL$
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LiveSupport_Core_NumericRangeConstraint_h
|
||||||
|
#define LiveSupport_Core_NumericRangeConstraint_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/MetadataConstraint.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class for representing a metadata constraint which allows numbers between
|
||||||
|
* two given values (inclusive).
|
||||||
|
*
|
||||||
|
* This is a concrete subclass of MetadataConstraint. Do not explicitly
|
||||||
|
* instantiate this class; create a MetadataConstraint object instead, and
|
||||||
|
* configure it with an XML element with the appropriate type attribute.
|
||||||
|
*
|
||||||
|
* This object has to be configured with an XML configuration element
|
||||||
|
* called constraint. This may look like the following:
|
||||||
|
*
|
||||||
|
* <pre><code>
|
||||||
|
* <constraint type = "numericRange">
|
||||||
|
* <value>1</value>
|
||||||
|
* <value>12</value>
|
||||||
|
* </constraint>
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* A metadata type with this kind of constraint can only accept (decimal,
|
||||||
|
* non-negative) integer values, i.e., [0-9]+, which are greater than or
|
||||||
|
* equal to the first value given, and less than or equal to the second
|
||||||
|
* value given.
|
||||||
|
*
|
||||||
|
* The DTD for the expected XML element looks like the following:
|
||||||
|
*
|
||||||
|
* <pre><code>
|
||||||
|
* <!ELEMENT constraint (value, value) >
|
||||||
|
* <!ATTLIST constraint type "numericRange" #FIXED >
|
||||||
|
* <!ELEMENT value (#PCDATA) >
|
||||||
|
* </code></pre>
|
||||||
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
* @see NumericRangeConstraintContainer
|
||||||
|
*/
|
||||||
|
class NumericRangeConstraint : public MetadataConstraint
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The integer type used by the constraint.
|
||||||
|
*/
|
||||||
|
typedef unsigned long long ValueType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The smallest value allowed by the constraint.
|
||||||
|
*/
|
||||||
|
ValueType minValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The largest value allowed by the constraint.
|
||||||
|
*/
|
||||||
|
ValueType maxValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a number from an XML node.
|
||||||
|
*
|
||||||
|
* @param node the node containing the number.
|
||||||
|
* @return the number read from the node.
|
||||||
|
* @exception std::invalid_argument if the XML node is not
|
||||||
|
* of the expected form.
|
||||||
|
*/
|
||||||
|
ValueType
|
||||||
|
readNumberFromNode(const xmlpp::Node * node) const
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a number from a string.
|
||||||
|
*
|
||||||
|
* @param value the string containing the number.
|
||||||
|
* @return the number read from the string.
|
||||||
|
* @exception std::invalid_argument if the string does not contain
|
||||||
|
* a number.
|
||||||
|
*/
|
||||||
|
ValueType
|
||||||
|
readNumber(Ptr<const Glib::ustring>::Ref value) const
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
NumericRangeConstraint() throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A virtual destructor, as this class has virtual functions.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~NumericRangeConstraint(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the XML element this object expects
|
||||||
|
* to be sent to a call to configure().
|
||||||
|
*
|
||||||
|
* @return the name of the expected XML configuration element.
|
||||||
|
*/
|
||||||
|
static const std::string
|
||||||
|
getConfigElementName(void) throw ()
|
||||||
|
{
|
||||||
|
return MetadataConstraint::getConfigElementName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the metadata object based on an XML configuration element.
|
||||||
|
*
|
||||||
|
* @param elemen the XML configuration element.
|
||||||
|
* @exception std::invalid_argument of the supplied XML element
|
||||||
|
* contains bad configuration information
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
configure(const xmlpp::Element &element)
|
||||||
|
throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that the given value satisfies the constraint.
|
||||||
|
*
|
||||||
|
* @param value the value to be checked against the constraint.
|
||||||
|
* @return true if the value satisfies the constraint.
|
||||||
|
* @exception std::logic_error if the parameter is a 0 pointer.
|
||||||
|
*/
|
||||||
|
virtual bool
|
||||||
|
check(Ptr<const Glib::ustring>::Ref value) const
|
||||||
|
throw (std::logic_error);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LiveSupport_Core_NumericRangeConstraint_h
|
||||||
|
|
|
@ -89,20 +89,25 @@
|
||||||
<!ELEMENT gstreamerPlayer EMPTY >
|
<!ELEMENT gstreamerPlayer EMPTY >
|
||||||
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
|
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
|
||||||
|
|
||||||
<!ELEMENT metadataTypeContainer (metadataType+) >
|
|
||||||
|
|
||||||
<!ELEMENT stationLogo EMPTY >
|
<!ELEMENT stationLogo EMPTY >
|
||||||
<!ATTLIST stationLogo path CDATA #REQUIRED >
|
<!ATTLIST stationLogo path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT testAudioUrl EMPTY >
|
<!ELEMENT testAudioUrl EMPTY >
|
||||||
<!ATTLIST testAudioUrl path CDATA #REQUIRED >
|
<!ATTLIST testAudioUrl path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT metadataType EMPTY >
|
<!ELEMENT metadataTypeContainer (metadataType+) >
|
||||||
|
|
||||||
|
<!ELEMENT metadataType (constraint?) >
|
||||||
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey CDATA #REQUIRED >
|
||||||
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
|
<!ELEMENT constraint (value*) >
|
||||||
|
<!ATTLIST constraint type NMTOKEN #REQUIRED >
|
||||||
|
|
||||||
|
<!ELEMENT value (#PCDATA) >
|
||||||
|
|
||||||
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
||||||
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
||||||
|
@ -178,182 +183,196 @@
|
||||||
<testAudioUrl path = "file://var/testAudio.ogg" />
|
<testAudioUrl path = "file://var/testAudio.ogg" />
|
||||||
|
|
||||||
<metadataTypeContainer>
|
<metadataTypeContainer>
|
||||||
<metadataType dcName = "dc:title"
|
<metadataType dcName = "dc:title"
|
||||||
id3Tag = "TIT2"
|
id3Tag = "TIT2"
|
||||||
localizationKey = "title"
|
localizationKey = "title"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:creator"
|
<metadataType dcName = "dc:creator"
|
||||||
id3Tag = "TPE1"
|
id3Tag = "TPE1"
|
||||||
localizationKey = "creator"
|
localizationKey = "creator"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:source"
|
<metadataType dcName = "dc:source"
|
||||||
id3Tag = "TALB"
|
id3Tag = "TALB"
|
||||||
localizationKey = "album"
|
localizationKey = "album"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:year"
|
<metadataType dcName = "ls:year"
|
||||||
id3Tag = "TYER"
|
id3Tag = "TYER"
|
||||||
localizationKey = "year"
|
localizationKey = "year"
|
||||||
tab = "music"
|
tab = "music" >
|
||||||
|
<constraint type = "numericRange" >
|
||||||
|
<value>0</value>
|
||||||
|
<value>3000</value>
|
||||||
|
</constraint>
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "dc:type"
|
||||||
|
id3Tag = "TCON"
|
||||||
|
localizationKey = "genre"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:type"
|
<metadataType dcName = "dc:description"
|
||||||
id3Tag = "TCON"
|
id3Tag = "COMM"
|
||||||
localizationKey = "genre"
|
localizationKey = "description"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:description"
|
<metadataType dcName = "dc:format"
|
||||||
id3Tag = "COMM"
|
localizationKey = "format" >
|
||||||
localizationKey = "description"
|
<constraint type = "enumeration" >
|
||||||
tab = "main"
|
<value>mp3</value>
|
||||||
|
<value>mpeg</value>
|
||||||
|
<value>ogg</value>
|
||||||
|
</constraint>
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:bpm"
|
||||||
|
id3Tag = "TBPM"
|
||||||
|
localizationKey = "bpm"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:rating"
|
||||||
|
id3Tag = "POPM"
|
||||||
|
localizationKey = "rating"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:format"
|
<metadataType dcName = "dcterms:extent"
|
||||||
localizationKey = "format"
|
localizationKey = "length"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:bpm"
|
<metadataType dcName = "ls:encoded_by"
|
||||||
id3Tag = "TBPM"
|
id3Tag = "TENC"
|
||||||
localizationKey = "bpm"
|
localizationKey = "encoded_by"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:rating"
|
<metadataType dcName = "ls:track_num"
|
||||||
id3Tag = "POPM"
|
id3Tag = "TRCK"
|
||||||
localizationKey = "rating"
|
localizationKey = "track_number"
|
||||||
tab = "music"
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:disc_num"
|
||||||
|
id3Tag = "TPOS"
|
||||||
|
localizationKey = "disc_number"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:mood"
|
||||||
|
id3Tag = "TMOO"
|
||||||
|
localizationKey = "mood"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dcterms:extent"
|
<metadataType dcName = "dc:publisher"
|
||||||
localizationKey = "length"
|
id3Tag = "TPUB"
|
||||||
|
localizationKey = "publishing_label"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:encoded_by"
|
<metadataType dcName = "ls:composer"
|
||||||
id3Tag = "TENC"
|
id3Tag = "TCOM"
|
||||||
localizationKey = "encoded_by"
|
localizationKey = "composer"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:track_num"
|
<metadataType dcName = "ls:bitrate"
|
||||||
id3Tag = "TRCK"
|
localizationKey = "bitrate"
|
||||||
localizationKey = "track_number"
|
tab = "music" >
|
||||||
tab = "music"
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:channels"
|
||||||
|
localizationKey = "channels"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:disc_num"
|
<metadataType dcName = "ls:samplerate"
|
||||||
id3Tag = "TPOS"
|
localizationKey = "sample_rate"
|
||||||
localizationKey = "disc_number"
|
tab = "music" >
|
||||||
tab = "music"
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:encoder"
|
||||||
|
id3Tag = "TSSE"
|
||||||
|
localizationKey = "encoding_software"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:mood"
|
<metadataType dcName = "ls:crc"
|
||||||
id3Tag = "TMOO"
|
localizationKey = "checksum"
|
||||||
localizationKey = "mood"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:publisher"
|
<metadataType dcName = "ls:lyrics"
|
||||||
id3Tag = "TPUB"
|
localizationKey = "lyrics"
|
||||||
localizationKey = "publishing_label"
|
tab = "music"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:composer"
|
<metadataType dcName = "ls:orchestra"
|
||||||
id3Tag = "TCOM"
|
id3Tag = "TPE2"
|
||||||
localizationKey = "composer"
|
localizationKey = "orchestra_or_band"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:bitrate"
|
<metadataType dcName = "ls:conductor"
|
||||||
localizationKey = "bitrate"
|
id3Tag = "TPE3"
|
||||||
tab = "music"
|
localizationKey = "conductor"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:channels"
|
<metadataType dcName = "ls:lyricist"
|
||||||
localizationKey = "channels"
|
id3Tag = "TEXT"
|
||||||
tab = "music"
|
localizationKey = "lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:samplerate"
|
<metadataType dcName = "ls:originallyricist"
|
||||||
localizationKey = "sample_rate"
|
id3Tag = "TOLY"
|
||||||
tab = "music"
|
localizationKey = "original_lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:encoder"
|
<metadataType dcName = "ls:radiostationname"
|
||||||
id3Tag = "TSSE"
|
id3Tag = "TRSN"
|
||||||
localizationKey = "encoding_software"
|
localizationKey = "radio_station_name"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:crc"
|
<metadataType dcName = "ls:audiofileinfourl"
|
||||||
localizationKey = "checksum"
|
id3Tag = "WOAF"
|
||||||
|
localizationKey = "audio_file_info_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyrics"
|
<metadataType dcName = "ls:artisturl"
|
||||||
localizationKey = "lyrics"
|
id3Tag = "WOAR"
|
||||||
tab = "music"
|
localizationKey = "artist_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:orchestra"
|
<metadataType dcName = "ls:audiosourceurl"
|
||||||
id3Tag = "TPE2"
|
id3Tag = "WOAS"
|
||||||
localizationKey = "orchestra_or_band"
|
localizationKey = "audio_source_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:conductor"
|
<metadataType dcName = "ls:radiostationurl"
|
||||||
id3Tag = "TPE3"
|
id3Tag = "WORS"
|
||||||
localizationKey = "conductor"
|
localizationKey = "radio_station_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyricist"
|
<metadataType dcName = "ls:buycdurl"
|
||||||
id3Tag = "TEXT"
|
id3Tag = "WPAY"
|
||||||
localizationKey = "lyricist"
|
localizationKey = "buy_cd_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:originallyricist"
|
<metadataType dcName = "ls:isrcnumber"
|
||||||
id3Tag = "TOLY"
|
id3Tag = "TSRC"
|
||||||
localizationKey = "original_lyricist"
|
localizationKey = "isrc_number"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationname"
|
<metadataType dcName = "ls:catalognumber"
|
||||||
id3Tag = "TRSN"
|
localizationKey = "catalog_number"
|
||||||
localizationKey = "radio_station_name"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiofileinfourl"
|
<metadataType dcName = "ls:originalartist"
|
||||||
id3Tag = "WOAF"
|
id3Tag = "TOPE"
|
||||||
localizationKey = "audio_file_info_url"
|
localizationKey = "original_artist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:artisturl"
|
<metadataType dcName = "dc:rights"
|
||||||
id3Tag = "WOAR"
|
id3Tag = "TCOP"
|
||||||
localizationKey = "artist_url"
|
localizationKey = "copyright"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiosourceurl"
|
<metadataType dcName = "dcterms:temporal"
|
||||||
id3Tag = "WOAS"
|
localizationKey = "report_date_time"
|
||||||
localizationKey = "audio_source_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationurl"
|
<metadataType dcName = "dcterms:spatial"
|
||||||
id3Tag = "WORS"
|
localizationKey = "report_location"
|
||||||
localizationKey = "radio_station_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:buycdurl"
|
<metadataType dcName = "dcterms:entity"
|
||||||
id3Tag = "WPAY"
|
localizationKey = "report_organizations"
|
||||||
localizationKey = "buy_cd_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:isrcnumber"
|
<metadataType dcName = "dc:subject"
|
||||||
id3Tag = "TSRC"
|
localizationKey = "subject"
|
||||||
localizationKey = "isrc_number"
|
tab = "voice"
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:catalognumber"
|
|
||||||
localizationKey = "catalog_number"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:originalartist"
|
|
||||||
id3Tag = "TOPE"
|
|
||||||
localizationKey = "original_artist"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dc:rights"
|
|
||||||
id3Tag = "TCOP"
|
|
||||||
localizationKey = "copyright"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:temporal"
|
|
||||||
localizationKey = "report_date_time"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:spatial"
|
|
||||||
localizationKey = "report_location"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:entity"
|
|
||||||
localizationKey = "report_organizations"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dc:subject"
|
|
||||||
localizationKey = "subject"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
|
|
@ -89,20 +89,25 @@
|
||||||
<!ELEMENT gstreamerPlayer EMPTY >
|
<!ELEMENT gstreamerPlayer EMPTY >
|
||||||
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
|
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
|
||||||
|
|
||||||
<!ELEMENT metadataTypeContainer (metadataType+) >
|
|
||||||
|
|
||||||
<!ELEMENT stationLogo EMPTY >
|
<!ELEMENT stationLogo EMPTY >
|
||||||
<!ATTLIST stationLogo path CDATA #REQUIRED >
|
<!ATTLIST stationLogo path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT testAudioUrl EMPTY >
|
<!ELEMENT testAudioUrl EMPTY >
|
||||||
<!ATTLIST testAudioUrl path CDATA #REQUIRED >
|
<!ATTLIST testAudioUrl path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT metadataType EMPTY >
|
<!ELEMENT metadataTypeContainer (metadataType+) >
|
||||||
|
|
||||||
|
<!ELEMENT metadataType (constraint?) >
|
||||||
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey CDATA #REQUIRED >
|
||||||
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
|
<!ELEMENT constraint (value*) >
|
||||||
|
<!ATTLIST constraint type NMTOKEN #REQUIRED >
|
||||||
|
|
||||||
|
<!ELEMENT value (#PCDATA) >
|
||||||
|
|
||||||
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
||||||
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
||||||
|
@ -177,182 +182,196 @@
|
||||||
<testAudioUrl path = "file://ls_var_dir/LiveSupport/testAudio.ogg" />
|
<testAudioUrl path = "file://ls_var_dir/LiveSupport/testAudio.ogg" />
|
||||||
|
|
||||||
<metadataTypeContainer>
|
<metadataTypeContainer>
|
||||||
<metadataType dcName = "dc:title"
|
<metadataType dcName = "dc:title"
|
||||||
id3Tag = "TIT2"
|
id3Tag = "TIT2"
|
||||||
localizationKey = "title"
|
localizationKey = "title"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:creator"
|
<metadataType dcName = "dc:creator"
|
||||||
id3Tag = "TPE1"
|
id3Tag = "TPE1"
|
||||||
localizationKey = "creator"
|
localizationKey = "creator"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:source"
|
<metadataType dcName = "dc:source"
|
||||||
id3Tag = "TALB"
|
id3Tag = "TALB"
|
||||||
localizationKey = "album"
|
localizationKey = "album"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:year"
|
<metadataType dcName = "ls:year"
|
||||||
id3Tag = "TYER"
|
id3Tag = "TYER"
|
||||||
localizationKey = "year"
|
localizationKey = "year"
|
||||||
tab = "music"
|
tab = "music" >
|
||||||
|
<constraint type = "numericRange" >
|
||||||
|
<value>0</value>
|
||||||
|
<value>3000</value>
|
||||||
|
</constraint>
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "dc:type"
|
||||||
|
id3Tag = "TCON"
|
||||||
|
localizationKey = "genre"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:type"
|
<metadataType dcName = "dc:description"
|
||||||
id3Tag = "TCON"
|
id3Tag = "COMM"
|
||||||
localizationKey = "genre"
|
localizationKey = "description"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:description"
|
<metadataType dcName = "dc:format"
|
||||||
id3Tag = "COMM"
|
localizationKey = "format" >
|
||||||
localizationKey = "description"
|
<constraint type = "enumeration" >
|
||||||
tab = "main"
|
<value>mp3</value>
|
||||||
|
<value>mpeg</value>
|
||||||
|
<value>ogg</value>
|
||||||
|
</constraint>
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:bpm"
|
||||||
|
id3Tag = "TBPM"
|
||||||
|
localizationKey = "bpm"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:rating"
|
||||||
|
id3Tag = "POPM"
|
||||||
|
localizationKey = "rating"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:format"
|
<metadataType dcName = "dcterms:extent"
|
||||||
localizationKey = "format"
|
localizationKey = "length"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:bpm"
|
<metadataType dcName = "ls:encoded_by"
|
||||||
id3Tag = "TBPM"
|
id3Tag = "TENC"
|
||||||
localizationKey = "bpm"
|
localizationKey = "encoded_by"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:rating"
|
<metadataType dcName = "ls:track_num"
|
||||||
id3Tag = "POPM"
|
id3Tag = "TRCK"
|
||||||
localizationKey = "rating"
|
localizationKey = "track_number"
|
||||||
tab = "music"
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:disc_num"
|
||||||
|
id3Tag = "TPOS"
|
||||||
|
localizationKey = "disc_number"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:mood"
|
||||||
|
id3Tag = "TMOO"
|
||||||
|
localizationKey = "mood"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dcterms:extent"
|
<metadataType dcName = "dc:publisher"
|
||||||
localizationKey = "length"
|
id3Tag = "TPUB"
|
||||||
|
localizationKey = "publishing_label"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:encoded_by"
|
<metadataType dcName = "ls:composer"
|
||||||
id3Tag = "TENC"
|
id3Tag = "TCOM"
|
||||||
localizationKey = "encoded_by"
|
localizationKey = "composer"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:track_num"
|
<metadataType dcName = "ls:bitrate"
|
||||||
id3Tag = "TRCK"
|
localizationKey = "bitrate"
|
||||||
localizationKey = "track_number"
|
tab = "music" >
|
||||||
tab = "music"
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:channels"
|
||||||
|
localizationKey = "channels"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:disc_num"
|
<metadataType dcName = "ls:samplerate"
|
||||||
id3Tag = "TPOS"
|
localizationKey = "sample_rate"
|
||||||
localizationKey = "disc_number"
|
tab = "music" >
|
||||||
tab = "music"
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:encoder"
|
||||||
|
id3Tag = "TSSE"
|
||||||
|
localizationKey = "encoding_software"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:mood"
|
<metadataType dcName = "ls:crc"
|
||||||
id3Tag = "TMOO"
|
localizationKey = "checksum"
|
||||||
localizationKey = "mood"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:publisher"
|
<metadataType dcName = "ls:lyrics"
|
||||||
id3Tag = "TPUB"
|
localizationKey = "lyrics"
|
||||||
localizationKey = "publishing_label"
|
tab = "music"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:composer"
|
<metadataType dcName = "ls:orchestra"
|
||||||
id3Tag = "TCOM"
|
id3Tag = "TPE2"
|
||||||
localizationKey = "composer"
|
localizationKey = "orchestra_or_band"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:bitrate"
|
<metadataType dcName = "ls:conductor"
|
||||||
localizationKey = "bitrate"
|
id3Tag = "TPE3"
|
||||||
tab = "music"
|
localizationKey = "conductor"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:channels"
|
<metadataType dcName = "ls:lyricist"
|
||||||
localizationKey = "channels"
|
id3Tag = "TEXT"
|
||||||
tab = "music"
|
localizationKey = "lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:samplerate"
|
<metadataType dcName = "ls:originallyricist"
|
||||||
localizationKey = "sample_rate"
|
id3Tag = "TOLY"
|
||||||
tab = "music"
|
localizationKey = "original_lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:encoder"
|
<metadataType dcName = "ls:radiostationname"
|
||||||
id3Tag = "TSSE"
|
id3Tag = "TRSN"
|
||||||
localizationKey = "encoding_software"
|
localizationKey = "radio_station_name"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:crc"
|
<metadataType dcName = "ls:audiofileinfourl"
|
||||||
localizationKey = "checksum"
|
id3Tag = "WOAF"
|
||||||
|
localizationKey = "audio_file_info_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyrics"
|
<metadataType dcName = "ls:artisturl"
|
||||||
localizationKey = "lyrics"
|
id3Tag = "WOAR"
|
||||||
tab = "music"
|
localizationKey = "artist_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:orchestra"
|
<metadataType dcName = "ls:audiosourceurl"
|
||||||
id3Tag = "TPE2"
|
id3Tag = "WOAS"
|
||||||
localizationKey = "orchestra_or_band"
|
localizationKey = "audio_source_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:conductor"
|
<metadataType dcName = "ls:radiostationurl"
|
||||||
id3Tag = "TPE3"
|
id3Tag = "WORS"
|
||||||
localizationKey = "conductor"
|
localizationKey = "radio_station_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyricist"
|
<metadataType dcName = "ls:buycdurl"
|
||||||
id3Tag = "TEXT"
|
id3Tag = "WPAY"
|
||||||
localizationKey = "lyricist"
|
localizationKey = "buy_cd_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:originallyricist"
|
<metadataType dcName = "ls:isrcnumber"
|
||||||
id3Tag = "TOLY"
|
id3Tag = "TSRC"
|
||||||
localizationKey = "original_lyricist"
|
localizationKey = "isrc_number"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationname"
|
<metadataType dcName = "ls:catalognumber"
|
||||||
id3Tag = "TRSN"
|
localizationKey = "catalog_number"
|
||||||
localizationKey = "radio_station_name"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiofileinfourl"
|
<metadataType dcName = "ls:originalartist"
|
||||||
id3Tag = "WOAF"
|
id3Tag = "TOPE"
|
||||||
localizationKey = "audio_file_info_url"
|
localizationKey = "original_artist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:artisturl"
|
<metadataType dcName = "dc:rights"
|
||||||
id3Tag = "WOAR"
|
id3Tag = "TCOP"
|
||||||
localizationKey = "artist_url"
|
localizationKey = "copyright"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiosourceurl"
|
<metadataType dcName = "dcterms:temporal"
|
||||||
id3Tag = "WOAS"
|
localizationKey = "report_date_time"
|
||||||
localizationKey = "audio_source_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationurl"
|
<metadataType dcName = "dcterms:spatial"
|
||||||
id3Tag = "WORS"
|
localizationKey = "report_location"
|
||||||
localizationKey = "radio_station_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:buycdurl"
|
<metadataType dcName = "dcterms:entity"
|
||||||
id3Tag = "WPAY"
|
localizationKey = "report_organizations"
|
||||||
localizationKey = "buy_cd_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:isrcnumber"
|
<metadataType dcName = "dc:subject"
|
||||||
id3Tag = "TSRC"
|
localizationKey = "subject"
|
||||||
localizationKey = "isrc_number"
|
tab = "voice"
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:catalognumber"
|
|
||||||
localizationKey = "catalog_number"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:originalartist"
|
|
||||||
id3Tag = "TOPE"
|
|
||||||
localizationKey = "original_artist"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dc:rights"
|
|
||||||
id3Tag = "TCOP"
|
|
||||||
localizationKey = "copyright"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:temporal"
|
|
||||||
localizationKey = "report_date_time"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:spatial"
|
|
||||||
localizationKey = "report_location"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:entity"
|
|
||||||
localizationKey = "report_organizations"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dc:subject"
|
|
||||||
localizationKey = "subject"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
|
|
@ -89,20 +89,25 @@
|
||||||
<!ELEMENT gstreamerPlayer EMPTY >
|
<!ELEMENT gstreamerPlayer EMPTY >
|
||||||
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
|
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
|
||||||
|
|
||||||
<!ELEMENT metadataTypeContainer (metadataType+) >
|
|
||||||
|
|
||||||
<!ELEMENT stationLogo EMPTY >
|
<!ELEMENT stationLogo EMPTY >
|
||||||
<!ATTLIST stationLogo path CDATA #REQUIRED >
|
<!ATTLIST stationLogo path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT testAudioUrl EMPTY >
|
<!ELEMENT testAudioUrl EMPTY >
|
||||||
<!ATTLIST testAudioUrl path CDATA #REQUIRED >
|
<!ATTLIST testAudioUrl path CDATA #REQUIRED >
|
||||||
|
|
||||||
<!ELEMENT metadataType EMPTY >
|
<!ELEMENT metadataTypeContainer (metadataType+) >
|
||||||
|
|
||||||
|
<!ELEMENT metadataType (constraint?) >
|
||||||
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey CDATA #REQUIRED >
|
||||||
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
|
<!ELEMENT constraint (value*) >
|
||||||
|
<!ATTLIST constraint type NMTOKEN #REQUIRED >
|
||||||
|
|
||||||
|
<!ELEMENT value (#PCDATA) >
|
||||||
|
|
||||||
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
<!ELEMENT keyboardShortcutList (keyboardShortcutContainer*) >
|
||||||
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
<!ELEMENT keyboardShortcutContainer (keyboardShortcut+) >
|
||||||
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
<!ATTLIST keyboardShortcutContainer windowName CDATA #REQUIRED >
|
||||||
|
@ -177,182 +182,196 @@
|
||||||
<testAudioUrl path = "file:var/testAudio.ogg" />
|
<testAudioUrl path = "file:var/testAudio.ogg" />
|
||||||
|
|
||||||
<metadataTypeContainer>
|
<metadataTypeContainer>
|
||||||
<metadataType dcName = "dc:title"
|
<metadataType dcName = "dc:title"
|
||||||
id3Tag = "TIT2"
|
id3Tag = "TIT2"
|
||||||
localizationKey = "title"
|
localizationKey = "title"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:creator"
|
<metadataType dcName = "dc:creator"
|
||||||
id3Tag = "TPE1"
|
id3Tag = "TPE1"
|
||||||
localizationKey = "creator"
|
localizationKey = "creator"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:source"
|
<metadataType dcName = "dc:source"
|
||||||
id3Tag = "TALB"
|
id3Tag = "TALB"
|
||||||
localizationKey = "album"
|
localizationKey = "album"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:year"
|
<metadataType dcName = "ls:year"
|
||||||
id3Tag = "TYER"
|
id3Tag = "TYER"
|
||||||
localizationKey = "year"
|
localizationKey = "year"
|
||||||
tab = "music"
|
tab = "music" >
|
||||||
|
<constraint type = "numericRange" >
|
||||||
|
<value>0</value>
|
||||||
|
<value>3000</value>
|
||||||
|
</constraint>
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "dc:type"
|
||||||
|
id3Tag = "TCON"
|
||||||
|
localizationKey = "genre"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:type"
|
<metadataType dcName = "dc:description"
|
||||||
id3Tag = "TCON"
|
id3Tag = "COMM"
|
||||||
localizationKey = "genre"
|
localizationKey = "description"
|
||||||
tab = "main"
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:description"
|
<metadataType dcName = "dc:format"
|
||||||
id3Tag = "COMM"
|
localizationKey = "format" >
|
||||||
localizationKey = "description"
|
<constraint type = "enumeration" >
|
||||||
tab = "main"
|
<value>mp3</value>
|
||||||
|
<value>mpeg</value>
|
||||||
|
<value>ogg</value>
|
||||||
|
</constraint>
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:bpm"
|
||||||
|
id3Tag = "TBPM"
|
||||||
|
localizationKey = "bpm"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:rating"
|
||||||
|
id3Tag = "POPM"
|
||||||
|
localizationKey = "rating"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:format"
|
<metadataType dcName = "dcterms:extent"
|
||||||
localizationKey = "format"
|
localizationKey = "length"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:bpm"
|
<metadataType dcName = "ls:encoded_by"
|
||||||
id3Tag = "TBPM"
|
id3Tag = "TENC"
|
||||||
localizationKey = "bpm"
|
localizationKey = "encoded_by"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:rating"
|
<metadataType dcName = "ls:track_num"
|
||||||
id3Tag = "POPM"
|
id3Tag = "TRCK"
|
||||||
localizationKey = "rating"
|
localizationKey = "track_number"
|
||||||
tab = "music"
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:disc_num"
|
||||||
|
id3Tag = "TPOS"
|
||||||
|
localizationKey = "disc_number"
|
||||||
|
tab = "music" >
|
||||||
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:mood"
|
||||||
|
id3Tag = "TMOO"
|
||||||
|
localizationKey = "mood"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dcterms:extent"
|
<metadataType dcName = "dc:publisher"
|
||||||
localizationKey = "length"
|
id3Tag = "TPUB"
|
||||||
|
localizationKey = "publishing_label"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:encoded_by"
|
<metadataType dcName = "ls:composer"
|
||||||
id3Tag = "TENC"
|
id3Tag = "TCOM"
|
||||||
localizationKey = "encoded_by"
|
localizationKey = "composer"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:track_num"
|
<metadataType dcName = "ls:bitrate"
|
||||||
id3Tag = "TRCK"
|
localizationKey = "bitrate"
|
||||||
localizationKey = "track_number"
|
tab = "music" >
|
||||||
tab = "music"
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:channels"
|
||||||
|
localizationKey = "channels"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:disc_num"
|
<metadataType dcName = "ls:samplerate"
|
||||||
id3Tag = "TPOS"
|
localizationKey = "sample_rate"
|
||||||
localizationKey = "disc_number"
|
tab = "music" >
|
||||||
tab = "music"
|
<constraint type = "numeric" />
|
||||||
|
</metadataType>
|
||||||
|
<metadataType dcName = "ls:encoder"
|
||||||
|
id3Tag = "TSSE"
|
||||||
|
localizationKey = "encoding_software"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:mood"
|
<metadataType dcName = "ls:crc"
|
||||||
id3Tag = "TMOO"
|
localizationKey = "checksum"
|
||||||
localizationKey = "mood"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:publisher"
|
<metadataType dcName = "ls:lyrics"
|
||||||
id3Tag = "TPUB"
|
localizationKey = "lyrics"
|
||||||
localizationKey = "publishing_label"
|
tab = "music"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:composer"
|
<metadataType dcName = "ls:orchestra"
|
||||||
id3Tag = "TCOM"
|
id3Tag = "TPE2"
|
||||||
localizationKey = "composer"
|
localizationKey = "orchestra_or_band"
|
||||||
tab = "music"
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:bitrate"
|
<metadataType dcName = "ls:conductor"
|
||||||
localizationKey = "bitrate"
|
id3Tag = "TPE3"
|
||||||
tab = "music"
|
localizationKey = "conductor"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:channels"
|
<metadataType dcName = "ls:lyricist"
|
||||||
localizationKey = "channels"
|
id3Tag = "TEXT"
|
||||||
tab = "music"
|
localizationKey = "lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:samplerate"
|
<metadataType dcName = "ls:originallyricist"
|
||||||
localizationKey = "sample_rate"
|
id3Tag = "TOLY"
|
||||||
tab = "music"
|
localizationKey = "original_lyricist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:encoder"
|
<metadataType dcName = "ls:radiostationname"
|
||||||
id3Tag = "TSSE"
|
id3Tag = "TRSN"
|
||||||
localizationKey = "encoding_software"
|
localizationKey = "radio_station_name"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:crc"
|
<metadataType dcName = "ls:audiofileinfourl"
|
||||||
localizationKey = "checksum"
|
id3Tag = "WOAF"
|
||||||
|
localizationKey = "audio_file_info_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyrics"
|
<metadataType dcName = "ls:artisturl"
|
||||||
localizationKey = "lyrics"
|
id3Tag = "WOAR"
|
||||||
tab = "music"
|
localizationKey = "artist_url"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:orchestra"
|
<metadataType dcName = "ls:audiosourceurl"
|
||||||
id3Tag = "TPE2"
|
id3Tag = "WOAS"
|
||||||
localizationKey = "orchestra_or_band"
|
localizationKey = "audio_source_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:conductor"
|
<metadataType dcName = "ls:radiostationurl"
|
||||||
id3Tag = "TPE3"
|
id3Tag = "WORS"
|
||||||
localizationKey = "conductor"
|
localizationKey = "radio_station_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:lyricist"
|
<metadataType dcName = "ls:buycdurl"
|
||||||
id3Tag = "TEXT"
|
id3Tag = "WPAY"
|
||||||
localizationKey = "lyricist"
|
localizationKey = "buy_cd_url"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:originallyricist"
|
<metadataType dcName = "ls:isrcnumber"
|
||||||
id3Tag = "TOLY"
|
id3Tag = "TSRC"
|
||||||
localizationKey = "original_lyricist"
|
localizationKey = "isrc_number"
|
||||||
tab = "music"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationname"
|
<metadataType dcName = "ls:catalognumber"
|
||||||
id3Tag = "TRSN"
|
localizationKey = "catalog_number"
|
||||||
localizationKey = "radio_station_name"
|
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiofileinfourl"
|
<metadataType dcName = "ls:originalartist"
|
||||||
id3Tag = "WOAF"
|
id3Tag = "TOPE"
|
||||||
localizationKey = "audio_file_info_url"
|
localizationKey = "original_artist"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:artisturl"
|
<metadataType dcName = "dc:rights"
|
||||||
id3Tag = "WOAR"
|
id3Tag = "TCOP"
|
||||||
localizationKey = "artist_url"
|
localizationKey = "copyright"
|
||||||
|
tab = "music"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:audiosourceurl"
|
<metadataType dcName = "dcterms:temporal"
|
||||||
id3Tag = "WOAS"
|
localizationKey = "report_date_time"
|
||||||
localizationKey = "audio_source_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:radiostationurl"
|
<metadataType dcName = "dcterms:spatial"
|
||||||
id3Tag = "WORS"
|
localizationKey = "report_location"
|
||||||
localizationKey = "radio_station_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:buycdurl"
|
<metadataType dcName = "dcterms:entity"
|
||||||
id3Tag = "WPAY"
|
localizationKey = "report_organizations"
|
||||||
localizationKey = "buy_cd_url"
|
tab = "voice"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "ls:isrcnumber"
|
<metadataType dcName = "dc:subject"
|
||||||
id3Tag = "TSRC"
|
localizationKey = "subject"
|
||||||
localizationKey = "isrc_number"
|
tab = "voice"
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:catalognumber"
|
|
||||||
localizationKey = "catalog_number"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "ls:originalartist"
|
|
||||||
id3Tag = "TOPE"
|
|
||||||
localizationKey = "original_artist"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dc:rights"
|
|
||||||
id3Tag = "TCOP"
|
|
||||||
localizationKey = "copyright"
|
|
||||||
tab = "music"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:temporal"
|
|
||||||
localizationKey = "report_date_time"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:spatial"
|
|
||||||
localizationKey = "report_location"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dcterms:entity"
|
|
||||||
localizationKey = "report_organizations"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
|
||||||
<metadataType dcName = "dc:subject"
|
|
||||||
localizationKey = "subject"
|
|
||||||
tab = "voice"
|
|
||||||
/>
|
/>
|
||||||
</metadataTypeContainer>
|
</metadataTypeContainer>
|
||||||
|
|
||||||
|
|
|
@ -438,6 +438,9 @@ UploadFileWindow :: onUploadButtonClicked(void) throw ()
|
||||||
void
|
void
|
||||||
UploadFileWindow :: uploadAudioClip(void) throw ()
|
UploadFileWindow :: uploadAudioClip(void) throw ()
|
||||||
{
|
{
|
||||||
|
Ptr<MetadataTypeContainer>::Ref
|
||||||
|
metadataTypes = gLiveSupport->getMetadataTypeContainer();
|
||||||
|
|
||||||
for (unsigned int i=0; i < metadataKeys.size(); ++i) {
|
for (unsigned int i=0; i < metadataKeys.size(); ++i) {
|
||||||
Ptr<const Glib::ustring>::Ref metadataKey = metadataKeys[i];
|
Ptr<const Glib::ustring>::Ref metadataKey = metadataKeys[i];
|
||||||
Gtk::Entry * metadataEntry = metadataEntries[i];
|
Gtk::Entry * metadataEntry = metadataEntries[i];
|
||||||
|
@ -445,7 +448,17 @@ UploadFileWindow :: uploadAudioClip(void) throw ()
|
||||||
Ptr<const Glib::ustring>::Ref metadataValue(new Glib::ustring(
|
Ptr<const Glib::ustring>::Ref metadataValue(new Glib::ustring(
|
||||||
metadataEntry->get_text() ));
|
metadataEntry->get_text() ));
|
||||||
if (*metadataValue != "") {
|
if (*metadataValue != "") {
|
||||||
audioClip->setMetadata(metadataValue, *metadataKey);
|
if (metadataTypes->check(metadataValue, *metadataKey)) {
|
||||||
|
audioClip->setMetadata(metadataValue, *metadataKey);
|
||||||
|
} else {
|
||||||
|
Ptr<const MetadataType>::Ref
|
||||||
|
metadata = metadataTypes->getByDcName(*metadataKey);
|
||||||
|
Ptr<const Glib::ustring>::Ref
|
||||||
|
localizedName = metadata->getLocalizedName();
|
||||||
|
statusBar->set_text(*formatMessage("badMetadataMsg",
|
||||||
|
*localizedName));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,6 +472,7 @@ UploadFileWindow :: uploadAudioClip(void) throw ()
|
||||||
gLiveSupport->uploadAudioClip(audioClip);
|
gLiveSupport->uploadAudioClip(audioClip);
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
statusBar->set_text(e.what());
|
statusBar->set_text(e.what());
|
||||||
|
std::cerr << e.what();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ root:table
|
||||||
unsupportedFileTypeMsg:string
|
unsupportedFileTypeMsg:string
|
||||||
{ "Unsupported file type." }
|
{ "Unsupported file type." }
|
||||||
missingTitleMsg:string { "Please enter a title." }
|
missingTitleMsg:string { "Please enter a title." }
|
||||||
|
badMetadataMsg:string { "Invalid data for {0}." }
|
||||||
}
|
}
|
||||||
|
|
||||||
simplePlaylistManagementWindow:table
|
simplePlaylistManagementWindow:table
|
||||||
|
|
Loading…
Reference in New Issue