Grl.Registry

g GObject.Object GObject.Object Grl.Registry Grl.Registry GObject.Object->Grl.Registry

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class get_default ()
  activate_all_plugins ()
  activate_plugin_by_id (plugin_id)
  add_config (config)
  add_config_from_file (config_file)
  add_config_from_resource (resource_path)
  add_directory (path)
  get_metadata_keys ()
  get_plugins (only_loaded)
  get_sources (ranked)
  get_sources_by_operations (ops, ranked)
  load_all_plugins (activate)
  load_plugin (library_filename)
  load_plugin_directory (path)
  lookup_metadata_key (key_name)
  lookup_metadata_key_desc (key)
  lookup_metadata_key_name (key)
  lookup_metadata_key_relation (key)
  lookup_metadata_key_type (key)
  lookup_plugin (plugin_id)
  lookup_source (source_id)
  metadata_key_validate (key, value)
  register_metadata_key (param_spec, bind_key)
  register_source (plugin, source)
  unload_plugin (plugin_id)
  unregister_source (source)

Virtual Methods

Inherited:GObject.Object (7)

Properties

None

Signals

Inherited:GObject.Object (1)
Name Short Description
metadata-key-added Signals that a new metadata key has been registered.
source-added Signals that a source has been added to the registry.
source-removed Signals that a source has been removed from the registry.

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class Grl.Registry(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Grl.RegistryClass
classmethod get_default()
Returns:a new or an already created instance of the registry.

It is NOT MT-safe

Return type:Grl.Registry

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()
Returns:True if some plugin has been activated
Return type:bool

Activate all the plugins loaded.

New in version 0.3.0.

activate_plugin_by_id(plugin_id)
Parameters:plugin_id (str) – plugin identifier
Raises:GLib.Error
Returns:True if the plugin is loaded correctly
Return type:bool

Activates plugin identified by plugin_id.

New in version 0.3.0.

add_config(config)
Parameters:config (Grl.Config) – a configuration set
Raises:GLib.Error
Returns:True on success
Return type:bool

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:GLib.Error
Returns:True on success
Return type:bool

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:GLib.Error
Returns:True on success
Return type:bool

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 available Grl.Plugin s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.
Return type:[Grl.Plugin]

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 available Grl.Source s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.
Return type:[Grl.Source]

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 available Grl.Source s. The content of the list should not be modified or freed. Use g_list_free() when done using the list.

Return type:

[Grl.Source]

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:GLib.Error
Returns:False% is all the configured plugin paths are invalid, True% otherwise.
Return type:bool

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:GLib.Error
Returns:True if the module is loaded correctly
Return type:bool

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:GLib.Error
Returns:True if the directory is valid.
Return type:bool

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:int

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:str

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:str

Returns key name.

New in version 0.2.0.

lookup_metadata_key_relation(key)
Parameters:key (int) – a metadata key
Returns:a GLib.List of related keys, or None if key is invalid.
Return type:[int]

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:GObject.GType

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:Grl.Plugin

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:Grl.Source

This function will search and retrieve a source given its identifier.

New in version 0.2.0.

metadata_key_validate(key, value)
Parameters:
Returns:

True if complies

Return type:

bool

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:
Raises:

GLib.Error

Returns:

The #GrlKeyID registered.

Return type:

int

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 source
  • source (Grl.Source) – the source to register
Raises:

GLib.Error

Returns:

True if success, False% otherwise.

Return type:

bool

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:GLib.Error
Returns:True% on success.
Return type:bool

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:GLib.Error
Returns:True if success, False% otherwise.
Return type:bool

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:

RUN_FIRST, ACTION

Parameters:
  • registry (Grl.Registry) – The object which received the signal
  • key (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:

RUN_FIRST, ACTION

Parameters:
  • registry (Grl.Registry) – The object which received the signal
  • source (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:

RUN_FIRST, ACTION

Parameters:
  • registry (Grl.Registry) – The object which received the signal
  • source (Grl.Source) – the source that has been removed

Signals that a source has been removed from the registry.

New in version 0.2.0.