Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- Grl.date_time_from_iso8601(date)¶
- Parameters:
date (
str
) – a date expressed in iso8601 format- Returns:
a newly-allocated
GLib.DateTime
set to the time corresponding to date, orNone
if date could not be parsed properly.- Return type:
New in version 0.2.0.
- Grl.deinit()¶
Deinitializes the Grilo library.
Call this function after finalizing using Grilo, in order to free and clean up all the resources created.
New in version 0.2.8.
- Grl.g_value_dup(value)¶
- Parameters:
value (
GObject.Value
) – theGObject.Value
to copy- Returns:
a duplicated
GObject.Value
- Return type:
- Grl.g_value_free(value)¶
- Parameters:
value (
GObject.Value
) –
- Grl.g_value_hashtable_new()¶
- Returns:
a new hash table made to contain GValues.
- Return type:
{
str
:GObject.Value
}
- Grl.g_value_hashtable_new_direct()¶
- Returns:
a new hash table made to contain GValues.
- Return type:
- Grl.g_value_new(g_type)¶
- Parameters:
g_type (
GObject.GType
) –- Return type:
- Grl.init(argv)¶
- Parameters:
- Returns:
list of arguments
- Return type:
argv: [
str
]
Initializes the Grilo library
New in version 0.1.6.
- Grl.init_get_option_group()¶
- Returns:
a pointer to Grilo’s option group. Should be dereferenced after use.
- Return type:
Returns a
GLib.OptionGroup
with Grilo’s argument specifications.This function is useful if you want to integrate Grilo with other libraries that use the GOption commandline parser (see
GLib.OptionContext.add_group
() ).New in version 0.1.6.
- Grl.log_configure(config)¶
- Parameters:
config (
str
) – A string describing the wanted log configuration
Configure a set of log domains. The default configuration is to display warning and error messages only for all the log domains.
The configuration string follows the following grammar:
config-list: config | config ',' config-list config: domain ':' level domain: '*' | [a-zA-Z0-9]+ level: '*' | '-' | named-level | num-level named-level: "none" | "error" | "warning" | "message" | "info" | "debug" num-level: [0-5]
examples:
“*:*”: maximum verbosity for all the log domains
“*:-”: don’t print any message
“media-source:debug,metadata-source:debug”: prints debug, info, message warning and error messages for the media-source and metadata-source log domains
It’s possible to override the log configuration at runtime by defining the GRL_DEBUG environment variable to a configuration string as described above
New in version 0.1.7.
- Grl.metadata_key_get_desc(key)¶
-
Retrieves the description associated with the key
New in version 0.1.6.
- Grl.metadata_key_get_name(key)¶
-
Retrieves the name associated with the key
New in version 0.1.6.
- Grl.metadata_key_get_type(key)¶
- Parameters:
key (
int
) – key to look up- Returns:
the expected value type
- Return type:
Retrieves the expected type for values associated with this key
New in version 0.2.0.
- Grl.multiple_get_media_from_uri(uri, keys, options, callback, *user_data)¶
- Parameters:
uri (
str
) – A URI that can be used to identify a media resourcekeys ([
int
]) – List of metadata keys we want to obtain.options (
Grl.OperationOptions
) – options wanted for that operationcallback (
Grl.SourceResolveCb
) – the user defined callbackuser_data (
object
orNone
) – the user data to pass to the user callback
Goes though all available media sources until it finds one capable of constructing a
Grl.Media
object representing the media resource exposed by uri.This method is asynchronous.
New in version 0.2.0.
- Grl.multiple_search(sources, text, keys, options, callback, *user_data)¶
- Parameters:
sources ([
Grl.Source
] orNone
) – aGLib.List
ofGrl.Source
s to search from (None
for all searchable sources)text (
str
) – the text to search foroptions (
Grl.OperationOptions
) – options wanted for that operationcallback (
Grl.SourceResultCb
) – the user defined callbackuser_data (
object
orNone
) – the user data to pass to the user callback
- Returns:
the operation identifier
- Return type:
Search for text in all the sources specified in sources.
If text is
None
thenNone
-text searchs will be used for each searchable plugin (seeGrl.Source.search
for more details).This method is asynchronous.
New in version 0.2.0.
- Grl.multiple_search_sync(sources, text, keys, options)¶
- Parameters:
sources ([
Grl.Source
] orNone
) – aGLib.List
ofGrl.Source
s where to search from (None
for all available sources with search capability)text (
str
) – the text to search foroptions (
Grl.OperationOptions
) – options wanted for that operation
- Raises:
- Returns:
a list with
Grl.Media
elements- Return type:
Search for text in all the sources specified in sources.
This method is synchronous.
New in version 0.2.0.
- Grl.operation_cancel(operation_id)¶
- Parameters:
operation_id (
int
) – the identifier of a running operation
Cancel an operation.
- Grl.operation_get_data(operation_id)¶
- Parameters:
operation_id (
int
) – the identifier of a running operation- Returns:
The previously attached data.
- Return type:
Obtains the previously attached data
- Grl.operation_set_data(operation_id, user_data)¶
- Parameters:
Attach a pointer to the specific operation.
- Grl.operation_set_data_full(operation_id, user_data, destroy_func)¶
- Parameters:
operation_id (
int
) – the identifier of a running operationdestroy_func (
GLib.DestroyNotify
orNone
) – function to release user_data when the operation terminates
Attach a pointer to the specific operation.
Note that the destroy_func callback is not called if user_data is
None
.New in version 0.2.7.
- Grl.paging_translate(skip, count, max_page_size, page_size, page_number, internal_offset)¶
- Parameters:
skip (
int
) – number of elements to skipcount (
int
) – number of elements to retrievemax_page_size (
int
) – maximum value for page size (0 for unlimited size)page_size (
int
) – optimal page sizepage_number (
int
) – page which contain the first element to retrieve (starting at 1)internal_offset (
int
) – in the page_number, offset where first element can be found (starting at 0)
Grilo browsing implements a paging mechanism through skip and count values.
But there are some services (like Jamendo or Flickr) where paging is done through a page number and page size: user request all elements in a page, specifying in most cases what is the page size.
This function is a helper for this task, computing from skip and count what is the optimal value of page size (limited by max_page_size), which page should the user request, and where requested data start inside the page.
By optimal we mean that it computes those values so only one page is required to satisfy the data, using the smallest page size. If user is limiting page size, then more requests to services might be needed. But still page size will be an optimal value.
If page_size is
None
, then page size will be max_page_size. If the later is also 0, then page size will beGObject.G_MAXUINT
.New in version 0.1.6.
- Grl.range_value_hashtable_insert(hash_table, key, min, max)¶
- Parameters:
min (
GObject.Value
) –max (
GObject.Value
) –
- Grl.range_value_hashtable_new()¶
- Returns:
- Return type: