Ubuntu TV Media Scanner
A centralized index for removable media content.
|
Definition of a property value. More...
#include <mediascanner/property.h>
Classes | |
class | Category |
class | MetadataKey |
class | Private |
class | Value |
Container class for all supported property values. More... | |
Public Types | |
enum | Boundary { Inclusive, Exclusive } |
Boundaries of a range query. More... | |
enum | MergeStrategy { MergeAppend, MergeReplace, MergePreserve } |
How to resolve merge conflicts for this property. More... | |
typedef boost::variant < boost::blank, bool, int32_t, uint64_t, double, Fraction, DateTime, String > | ValueBase |
typedef std::pair< Property, Property::Value > | BoundValue |
A property value bound to an actual property. More... | |
typedef std::map< Property, Value > | ValueMap |
Maps properties to their actual values. More... | |
typedef std::set< Property > | Set |
A set of distinct properties. More... | |
typedef std::function< bool(const Property &property)> | PropertyVisitor |
Functions of this kind are passed to the VisitAll() method. More... | |
typedef std::function< bool(GstDiscovererInfo *info, GstDiscovererStreamInfo *stream, ValueMap *item)> | StreamInfoFunction |
Functions of this kind are merge the discoverer's stream information. More... | |
Public Member Functions | |
Property () | |
Constructs an unidentified property. More... | |
Property (const Property &other) | |
Constructs a copy of the other property. More... | |
~Property () | |
String | field_name () const |
Name of the Lucene++ field. More... | |
const MetadataKey & | metadata_key () const |
Id of the Grilo metadata key. More... | |
Category | category () const |
Category of the property. More... | |
std::set< std::string > | origins () const |
Origins of this property. More... | |
bool | is_null () const |
Checks if the property is undefined (null). More... | |
bool | supports_full_text_search () const |
Checks if the property permits full text searches. More... | |
MergeStrategy | merge_strategy () const |
How to resolve merge conflicts for this property. More... | |
bool | MergeStreamInfo (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, ValueMap *properties) const |
Extracts property values from discoverer stream information. More... | |
LuceneFields | MakeFields (const Value &value) const |
Turns a property value into Lucene++ fields. More... | |
Value | TransformFields (const LuceneFields &fields) const |
Extracts property values of the Lucene++ fields. More... | |
Value | TransformSingleField (Lucene::FieldablePtr field) const |
Lucene::QueryPtr | MakeTermQuery (const Value &value) const |
Constructs a Lucene term query for this property and value. More... | |
Lucene::QueryPtr | MakeRangeQuery (const Value &lower_value, Boundary lower_boundary, const Value &upper_value, Boundary upper_boundary) const |
Constructs a Lucene term query for this property and value. More... | |
Lucene::QueryPtr | MakeRangeQuery (const Value &lower_value, const Value &upper_value) |
Constructs a Lucene term query for this property and value. More... | |
template<typename T > | |
bool | TransformTagValue (const GValue *input, Value *output) const |
Converts a tag value into a canonical property value. More... | |
bool | TransformGriloValue (const GValue *input, Value *output) const |
Converts a tag value into a canonical property value. More... | |
bool | TransformDBusVariant (GVariant *input, Value *output) const |
GValue * | MakeGriloValue (const Value &value) const |
Turns a property value into a Grilo value. More... | |
bool | operator== (const Property &other) const |
Checks if two properties are the same. More... | |
bool | operator!= (const Property &other) const |
Checks if two properties are the different. More... | |
operator const void * () const | |
Safe boolean cast. The more natural operator bool() is problematic because it leads to unwanted implicit casts. More... | |
bool | operator< (const Property &other) const |
Define sort order for usage in std::map. More... | |
Static Public Member Functions | |
static Property | FromFieldName (const String &name) |
Finds a property by its Lucene++ field name. More... | |
static Property | FromMetadataKey (GrlKeyID key) |
Finds a property by its Grilo metadata key. More... | |
static void | VisitAll (const PropertyVisitor &visit) |
Visits all property declarations known to the media scanner. More... | |
Protected Types | |
typedef std::shared_ptr< Private > | PrivatePtr |
Shared pointer to internal property fields. More... | |
Protected Member Functions | |
Property (PrivatePtr impl) | |
Constructs a new property instance. More... | |
StreamInfoFunction | bind_any (const StreamInfoFunction &first, const StreamInfoFunction &second) const |
template<typename ValueType > | |
bool | MergeAttribute (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, ValueType(*get_attribute)(const GstDiscovererInfo *), ValueMap *item) const |
template<typename ValueType , typename InfoType > | |
bool | MergeAttribute (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, ValueType(*get_attribute)(const InfoType *), ValueMap *item) const |
template<typename ValueType > | |
bool | MergeTag (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, const char *tag_name, ValueMap *item) const |
template<typename ValueType > | |
StreamInfoFunction | bind_attr (ValueType(*)(const GstDiscovererInfo *)) |
template<typename ValueType , typename InfoType > | |
StreamInfoFunction | bind_attr (ValueType(*)(const InfoType *)) |
template<typename ValueType > | |
StreamInfoFunction | bind_tag (const char *tag_name) const |
Static Protected Member Functions | |
static MetadataKey | define_boolean (const char *name, const char *nick, const char *blurb, bool default_value) |
static MetadataKey | define_datetime (const char *name, const char *nick, const char *blurb) |
static MetadataKey | define_string (const char *name, const char *nick, const char *blurb, const char *default_value=0) |
static bool | merge_nothing (const GstDiscovererInfo *, const GstDiscovererStreamInfo *, ValueMap *) |
static bool | MergeAny (GstDiscovererInfo *media, GstDiscovererStreamInfo *stream, const StreamInfoFunction &merge_first, const StreamInfoFunction &merge_second, ValueMap *item) |
Definition of a property value.
This class provides all the information to descibe data mappings between all the involved subsystems such as Lucene++, Grilo and GStreamer. It also provides facilities to convert property values among those systems.
Properties cannot be instantiated directly. Instead refer the constants declared in the mediascanner::schema namespace.
typedef std::pair<Property, Property::Value> mediascanner::Property::BoundValue |
A property value bound to an actual property.
|
protected |
Shared pointer to internal property fields.
typedef std::function<bool(const Property &property)> mediascanner::Property::PropertyVisitor |
Functions of this kind are passed to the VisitAll() method.
typedef std::set<Property> mediascanner::Property::Set |
A set of distinct properties.
typedef std::function<bool(GstDiscovererInfo *info, GstDiscovererStreamInfo *stream, ValueMap *item)> mediascanner::Property::StreamInfoFunction |
Functions of this kind are merge the discoverer's stream information.
typedef boost::variant<boost::blank, bool, int32_t, uint64_t, double, Fraction, DateTime, String> mediascanner::Property::ValueBase |
typedef std::map<Property, Value> mediascanner::Property::ValueMap |
Maps properties to their actual values.
|
inline |
Constructs an unidentified property.
Such properties are needed to support uninitialized variables and to support various container operations.
|
inline |
Constructs a copy of the other property.
[in] | other | - the copied property |
mediascanner::Property::~Property | ( | ) |
|
explicitprotected |
Constructs a new property instance.
This constructor is used create specializations of the Property class.
[in] | impl | - the private fields of the new property |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
String mediascanner::Property::field_name | ( | ) | const |
Name of the Lucene++ field.
Finds a property by its Lucene++ field name.
[in] | name | - the field name by which to search |
Finds a property by its Grilo metadata key.
[in] | key | - the metadata key ID to search for. |
|
inline |
Checks if the property is undefined (null).
LuceneFields mediascanner::Property::MakeFields | ( | const Value & | value) | const |
Turns a property value into Lucene++ fields.
[in] | value | - the property values to convert |
Turns a property value into a Grilo value.
[in] | value | - the property values to convert |
Lucene::QueryPtr mediascanner::Property::MakeRangeQuery | ( | const Value & | lower_value, |
Boundary | lower_boundary, | ||
const Value & | upper_value, | ||
Boundary | upper_boundary | ||
) | const |
Constructs a Lucene term query for this property and value.
[in] | lower_value | - the lower value to search for |
[in] | lower_boundary | - boundery to use for lower_value |
[in] | upper_value | - the upper value to search for |
[in] | upper_boundary | - boundery to use for upper_value |
|
inline |
Constructs a Lucene term query for this property and value.
The constructed query searchs for lower_value <= x < upper_value.
[in] | lower_value | - the lower value to search for |
[in] | upper_value | - the upper value to search for |
Lucene::QueryPtr mediascanner::Property::MakeTermQuery | ( | const Value & | value) | const |
Constructs a Lucene term query for this property and value.
[in] | value | - the value to search for |
|
inlinestaticprotected |
MergeStrategy mediascanner::Property::merge_strategy | ( | ) | const |
How to resolve merge conflicts for this property.
|
staticprotected |
|
protected |
|
protected |
bool mediascanner::Property::MergeStreamInfo | ( | GstDiscovererInfo * | media, |
GstDiscovererStreamInfo * | stream, | ||
ValueMap * | properties | ||
) | const |
Extracts property values from discoverer stream information.
[in] | info | - the discoverer info to investigate |
[in] | stream | - the stream info to investigate |
[in,out] | properties | - the item to update |
|
protected |
const MetadataKey& mediascanner::Property::metadata_key | ( | ) | const |
Id of the Grilo metadata key.
|
inline |
Safe boolean cast. The more natural operator bool() is problematic because it leads to unwanted implicit casts.
|
inline |
Checks if two properties are the different.
|
inline |
Define sort order for usage in std::map.
|
inline |
Checks if two properties are the same.
std::set<std::string> mediascanner::Property::origins | ( | ) | const |
Origins of this property.
bool mediascanner::Property::supports_full_text_search | ( | ) | const |
Checks if the property permits full text searches.
Value mediascanner::Property::TransformFields | ( | const LuceneFields & | fields) | const |
Extracts property values of the Lucene++ fields.
[in] | fields | - the Lucene++ fields to convert |
Converts a tag value into a canonical property value.
[in] | input | - the tag value to transform |
in/out] | output - location for the transformed value |
Value mediascanner::Property::TransformSingleField | ( | Lucene::FieldablePtr | field) | const |
bool mediascanner::Property::TransformTagValue | ( | const GValue * | input, |
Value * | output | ||
) | const |
Converts a tag value into a canonical property value.
[in] | input | - the tag value to transform |
in/out] | output - location for the transformed value |
|
static |
Visits all property declarations known to the media scanner.
[in] | visit | - a function that is called for each property |