Grl.Registry¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Signals that a new metadata key has been registered. |
|
Signals that a source has been added to the registry. |
|
Signals that a source has been removed from the registry. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Grl.Registry(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod get_default()¶
- Returns:
a new or an already created instance of the registry.
It is NOT MT-safe
- Return type:
As the registry is designed to work as a singleton, this method is in charge of creating the only instance or returned it if it is already in memory.
New in version 0.2.0.
- activate_all_plugins()¶
-
Activate all the plugins loaded.
New in version 0.3.0.
- activate_plugin_by_id(plugin_id)¶
- Parameters:
plugin_id (
str
) – plugin identifier- Raises:
- Returns:
True
if the plugin is loaded correctly- Return type:
Activates plugin identified by plugin_id.
New in version 0.3.0.
- add_config(config)¶
- Parameters:
config (
Grl.Config
) – a configuration set- Raises:
- Returns:
True
on success- Return type:
Add a configuration for a plugin/source.
New in version 0.2.0.
- add_config_from_file(config_file)¶
- Parameters:
config_file (
str
) – a key-value file containing the configuration- Raises:
- Returns:
True
on success- Return type:
Load plugin configurations from a .ini-like config file.
New in version 0.2.0.
- add_config_from_resource(resource_path)¶
- Parameters:
resource_path (
str
) – a key-value file containing the configuration- Raises:
- Returns:
True
on success- Return type:
Load plugin configurations from a .ini-like resource file.
New in version 0.2.8.
- add_directory(path)¶
- Parameters:
path (
str
) – a path with plugins
Set this path as part of default paths to load plugins.
New in version 0.2.0.
- get_metadata_keys()¶
- Returns:
a
GLib.List
with all the available #GrlKeyID s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.- Return type:
[
int
]
Returns a list with all registered keys in system.
New in version 0.2.0.
- get_plugins(only_loaded)¶
- Parameters:
only_loaded (
bool
) – whether the returned list shall include only loaded plugins- Returns:
a
GLib.List
of availableGrl.Plugin
s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.- Return type:
This function will return all the available plugins in the self.
If only_loaded is
True
, the plugin list will contain only plugins that are loaded.New in version 0.2.0.
- get_sources(ranked)¶
- Parameters:
ranked (
bool
) – whether the returned list shall be returned ordered by rank- Returns:
a
GLib.List
of availableGrl.Source
s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.- Return type:
This function will return all the available sources in the self.
If ranked is
True
, the source list will be ordered by rank.New in version 0.2.0.
- get_sources_by_operations(ops, ranked)¶
- Parameters:
ops (
Grl.SupportedOps
) – a bitwise mangle of the requested operations.ranked (
bool
) – whether the returned list shall be returned ordered by rank
- Returns:
a
GLib.List
of availableGrl.Source
s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.- Return type:
Give an array of all the available sources in the self capable of perform the operations requested in ops.
If ranked is
True
, the source list will be ordered by rank.New in version 0.2.0.
- load_all_plugins(activate)¶
- Parameters:
activate (
bool
) –True
if plugins must be activated after loading- Raises:
- Returns:
False
% is all the configured plugin paths are invalid,True
% otherwise.- Return type:
Load all the modules available in the default directory path.
The default directory path can be changed through the environment variable %GRL_PLUGIN_PATH and it can contain several paths separated by “:”
New in version 0.2.0.
- load_plugin(library_filename)¶
- Parameters:
library_filename (
str
) – the path to the so file- Raises:
- Returns:
True
if the module is loaded correctly- Return type:
Loads a module from shared object file stored in path
New in version 0.2.0.
- load_plugin_directory(path)¶
- Parameters:
path (
str
) – the path to the directory- Raises:
- Returns:
True
if the directory is valid.- Return type:
Loads a set of modules from directory in path which contains a group shared object files.
New in version 0.2.0.
- lookup_metadata_key(key_name)¶
- Parameters:
key_name (
str
) – the key name- Returns:
The metadata key, or
Grl.METADATA_KEY_INVALID
if not found- Return type:
Look up for the metadata key with name key_name.
New in version 0.2.0.
- lookup_metadata_key_desc(key)¶
- Parameters:
key (
int
) – a metadata key- Returns:
metadata key description, or
None
if not found- Return type:
Returns key description.
New in version 0.2.0.
- lookup_metadata_key_name(key)¶
- Parameters:
key (
int
) – a metadata key- Returns:
metadata key name, or
None
if not found- Return type:
Returns key name.
New in version 0.2.0.
- lookup_metadata_key_relation(key)¶
-
Look up the list of keys that have a relation with key.
key is included in that list.
New in version 0.2.0.
- lookup_metadata_key_type(key)¶
- Parameters:
key (
int
) – a metadata key- Returns:
metadata key type, or
GObject.TYPE_INVALID
if not found- Return type:
Returns key expected value type.
New in version 0.2.0.
- lookup_plugin(plugin_id)¶
- Parameters:
plugin_id (
str
) – the id of a plugin- Returns:
The plugin found
- Return type:
This function will search and retrieve a plugin given its identifier.
New in version 0.2.0.
- lookup_source(source_id)¶
- Parameters:
source_id (
str
) – the id of a source- Returns:
The source found.
- Return type:
This function will search and retrieve a source given its identifier.
New in version 0.2.0.
- metadata_key_validate(key, value)¶
- Parameters:
key (
int
) – a metadata keyvalue (
GObject.Value
) – value to be validate
- Returns:
True
if complies- Return type:
Validates value content complies with the key specification. That is, it has the expected type, and value are within the range specified in key (for integer values).
New in version 0.2.0.
- register_metadata_key(param_spec, bind_key)¶
- Parameters:
param_spec (
GObject.ParamSpec
) – The definition of the key to registerbind_key (
int
) – The key the new key is bind to, orGrl.METADATA_KEY_INVALID
if it is not bound.
- Raises:
- Returns:
The #GrlKeyID registered.
- Return type:
Registers a new metadata key, creating a relation between the new key and bind_key.
Two keys are related when the values of both keys are somehow related.
One example of a relation would be the one between the URI of a media resource and its mime-type: they are both tied together and one does not make sense without the other.
Relations between keys allow the framework to provide all the data that is somehow related when any of the related keys are requested.
New in version 0.3.0.
- register_source(plugin, source)¶
- Parameters:
plugin (
Grl.Plugin
) – the plugin which owns the sourcesource (
Grl.Source
) – the source to register
- Raises:
- Returns:
- Return type:
Register a source in the self with the given plugin information
New in version 0.2.0.
- unload_plugin(plugin_id)¶
- Parameters:
plugin_id (
str
) – the identifier of the plugin- Raises:
- Returns:
True
% on success.- Return type:
Unload from memory a module identified by plugin_id. This means call the module’s deinit function.
New in version 0.2.0.
- unregister_source(source)¶
- Parameters:
source (
Grl.Source
) – the source to unregister- Raises:
- Returns:
- Return type:
Removes the source from the self hash table
New in version 0.2.0.
Signal Details¶
- Grl.Registry.signals.metadata_key_added(registry, key)¶
- Signal Name:
metadata-key-added
- Flags:
- Parameters:
registry (
Grl.Registry
) – The object which received the signalkey (
str
) – the name of the new key added
Signals that a new metadata key has been registered.
New in version 0.2.10.
- Grl.Registry.signals.source_added(registry, source)¶
- Signal Name:
source-added
- Flags:
- Parameters:
registry (
Grl.Registry
) – The object which received the signalsource (
Grl.Source
) – the source that has been added
Signals that a source has been added to the registry.
New in version 0.2.0.
- Grl.Registry.signals.source_removed(registry, source)¶
- Signal Name:
source-removed
- Flags:
- Parameters:
registry (
Grl.Registry
) – The object which received the signalsource (
Grl.Source
) – the source that has been removed
Signals that a source has been removed from the registry.
New in version 0.2.0.