Grl

Grl — Metadata library supporting several services

Synopsis

#include <grilo.h>

void                grl_init                            (gint *argc,
                                                         gchar **argv[]);
GOptionGroup *      grl_init_get_option_group           (void);
void                grl_paging_translate                (guint skip,
                                                         guint count,
                                                         guint max_page_size,
                                                         guint *page_size,
                                                         guint *page_number,
                                                         guint *internal_offset);
GList *             grl_list_from_va                    (gpointer p,
                                                         ...);

Description

Grilo is a metadata retrieval library. Given a search or browse operation, the library will retrieve a set of metadata related to the operation from a set of on-line services.

The Grilo library should be initialized with grl_init() before it can be used. You should pass pointers to the main argc and argv variables so that Grilo can process its own command line options.

Details

grl_init ()

void                grl_init                            (gint *argc,
                                                         gchar **argv[]);

Initializes the Grilo library

argc :

number of input arguments, length of argv. [inout][allow-none]

argv :

list of arguments. [inout][element-type utf8][array length=argc][allow-none]

Since 0.1.6


grl_init_get_option_group ()

GOptionGroup *      grl_init_get_option_group           (void);

Returns a GOptionGroup 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 g_option_context_add_group() ).

Returns :

a pointer to Grilo's option group. Should be dereferenced after use.

Since 0.1.6


grl_paging_translate ()

void                grl_paging_translate                (guint skip,
                                                         guint count,
                                                         guint max_page_size,
                                                         guint *page_size,
                                                         guint *page_number,
                                                         guint *internal_offset);

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.

skip :

number of elements to skip

count :

number of elements to retrieve

max_page_size :

maximum value for page size

page_size :

optimal page size

page_number :

page which contain the first element to retrieve (starting at 1)

internal_offset :

in the page_number, offset where first element can be found (starting at 0)

Since 0.1.6


grl_list_from_va ()

GList *             grl_list_from_va                    (gpointer p,
                                                         ...);

Returns a GList containing the va_list pointers. Use NULL to finalize them,

p :

first pointer

... :

va_list pointers

Returns :

a GList.

Since 0.1.6