GtuberWebsite

GtuberWebsite — a base class for creating plugins

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GtuberWebsite

Description

Functions

GTUBER_WEBSITE_PLUGIN_DECLARE()

#define             GTUBER_WEBSITE_PLUGIN_DECLARE(camel,lower,upper)

Convenient macro to declare a new plugin that extends GtuberWebsite.

Parameters

camel

camel case name of the website.

 

lower

lowercase name of the website, with multiple words separated by _.

 

upper

uppercase name of the website.

 

GTUBER_WEBSITE_PLUGIN_DEFINE()

#define             GTUBER_WEBSITE_PLUGIN_DEFINE(camel,lower)

Convenient macro that wraps around G_DEFINE_TYPE with GtuberWebsite.

Parameters

camel

camel case name of the website.

 

lower

lowercase name of the website, with multiple words separated by _.

 

GTUBER_WEBSITE_PLUGIN_EXPORT_SCHEMES()

#define             GTUBER_WEBSITE_PLUGIN_EXPORT_SCHEMES(...)

Convenient macro that exports plugin supported schemes.

Parameters

...

NULL terminated list of supported schemes.

 

GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS()

#define             GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS(...)

Convenient macro that exports plugin supported hosts.

Parameters

...

NULL terminated list of supported hosts.

 

gtuber_website_get_uri ()

const gchar *
gtuber_website_get_uri (GtuberWebsite *website);

Parameters

website

a GtuberWebsite

 

Returns

current requested URI.

[transfer none]


gtuber_website_set_uri ()

void
gtuber_website_set_uri (GtuberWebsite *website,
                        const gchar *uri);

Set current requested URI.

This is only useful for plugin implementations where user requested URI needs to be altered, otherwise GtuberClient will set it automatically.

Parameters

website

a GtuberWebsite

 

uri

requested URI

 

gtuber_website_error_quark ()

GQuark
gtuber_website_error_quark (void);

Types and Values

GTUBER_WEBSITE_ERROR

#define GTUBER_WEBSITE_ERROR           (gtuber_website_error_quark ())

struct GtuberWebsite

struct GtuberWebsite;

Plugin website base class.


struct GtuberWebsiteClass

struct GtuberWebsiteClass {
  GObjectClass parent_class;

  gboolean handles_input_stream;

  void (* prepare) (GtuberWebsite *website);

  GtuberFlow (* create_request) (GtuberWebsite   *website,
                                 GtuberMediaInfo *info,
                                 SoupMessage    **msg,
                                 GError         **error);

  GtuberFlow (* read_response) (GtuberWebsite *website,
                                SoupMessage   *msg,
                                GError       **error);

  GtuberFlow (* parse_data) (GtuberWebsite   *website,
                             gchar           *data,
                             GtuberMediaInfo *info,
                             GError         **error);

  GtuberFlow (* parse_input_stream) (GtuberWebsite   *website,
                                     GInputStream    *stream,
                                     GtuberMediaInfo *info,
                                     GError         **error);

  GtuberFlow (* set_user_req_headers) (GtuberWebsite      *website,
                                       SoupMessageHeaders *req_headers,
                                       GHashTable         *user_headers,
                                       GError            **error);
};

Members

gboolean handles_input_stream;

When set to TRUE, parse_input_stream() will be called at parsing stage otherwise parse_response() will be used.

 

prepare ()

If plugin needs to do some post init blocking IO (like reading cache) before it can be used, this is a good place to do so.

 

create_request ()

Create and pass SoupMessage to send.

 

read_response ()

Use to check SoupStatus and response SoupMessageHeaders from send SoupMessage.

 

parse_data ()

Read data of response body and fill GtuberMediaInfo.

 

parse_input_stream ()

Read GInputStream and fill GtuberMediaInfo.

 

set_user_req_headers ()

Set request headers for user. Default implementation will set them from last SoupMessage, skipping some common and invalid ones.