Overview

Summary
Overview
Return codesCheck the return codes of the libquvi API functions.
New sessionEvery new session starts with quvi_init.
Parse URLTo parse an URL to media details, use quvi_parse.
Close active sessionTo end a session, call quvi_close.
ExampleBasic use, initialize new session and parse URL.

Return codes

Check the return codes of the libquvi API functions.  You can use quvi_strerror to convert the return codes to more meaningful error messages.

New session

Every new session starts with quvi_init.  An application may start using libquvi by creating a new session with quvi_init.  This function returns a new session handle which will be used by other API functions.

libquvi uses libcurl (by default) for network all operations, you can get the libcurl (easy interface) handle with quvi_getinfo and reuse it in your application.  Do not attempt to release this libcurl handle in your application, libquvi will take care of this when you call quvi_close.

Parse URL

To parse an URL to media details, use quvi_parse.  The session options may be manipulated with the quvi_setopt.  These options must be set before calling quvi_parse any URLs.  The parsed media details may be accessed with quvi_getprop.  When done with the media details, release the allocated resources by calling quvi_parse_close.

Close active session

To end a session, call quvi_close.  This releases the resources allocated previously by quvi_init.

Example

Basic use, initialize new session and parse URL.

#include <quvi/quvi.h>

#define URL "http://foo.bar/baz"

int main(int argc, char **argv)
{
  char *media_title, *media_url;
  quvi_media_t m;
  QUVIcode rc;
  quvi_t q;

  rc = quvi_init(&q);
  if (rc != QUVI_OK)
    {
      fprintf(stderr, "%s\n", quvi_strerror(q,rc));
      return (rc);
    }

  rc = quvi_parse(q, URL, &m);
  if (rc != QUVI_OK)
    {
      fprintf(stderr, "%s\n", quvi_strerror(q,rc));
      quvi_close(&q);
      return (rc);
    }

  quvi_getprop(m, QUVIPROP_PAGETITLE, &media_title);
  quvi_getprop(m, QUVIPROP_MEDIAURL, &media_url);
  puts(media_title);
  puts(media_url);

  quvi_parse_close(&m);
  quvi_close(&q);

  return (rc);
}
QUVIcode quvi_init(quvi_t *session)
Creates a new session.
QUVIcode quvi_parse(quvi_t session,
char *url,
quvi_media_t *media)
Parses an URL.
void quvi_close(quvi_t *session)
Closes a previously started session.
char *quvi_strerror(quvi_t session,
QUVIcode code)
Returns a corresponding error message to the return code.
QUVIcode quvi_getinfo(quvi_t session,
QUVIinfo info,
 ...)
Returns session info.
QUVIcode quvi_setopt(quvi_t session,
QUVIoption option,
 ...)
Sets a session option.
QUVIcode quvi_getprop(quvi_media_t media,
QUVIproperty property,
 ...)
Returns a media property.
void quvi_parse_close(quvi_media_t *media)
Releases a previously allocated media handle.
Close