GtuberWebsite: Gtuber Reference Manual

## GtuberWebsite GtuberWebsite — a base class for creating plugins |

## Functions

#define | GTUBER_WEBSITE_PLUGIN_DECLARE()
#define | GTUBER_WEBSITE_PLUGIN_DEFINE()
#define | GTUBER_WEBSITE_PLUGIN_EXPORT_SCHEMES()
#define | GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS()
#define | GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE()
#define | GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE_WITH_FALLBACK()
#define | GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE_WITH_PREPEND()
GUri * | gtuber_website_get_uri ()
void | gtuber_website_set_uri ()
const gchar * | gtuber_website_get_uri_string ()
gboolean | gtuber_website_set_uri_from_string ()
SoupCookieJar * | gtuber_website_get_cookies_jar ()
GQuark | gtuber_website_error_quark ()

## Types and Values

#define | GTUBER_WEBSITE_ERROR
struct | GtuberWebsite
struct | GtuberWebsiteClass

## 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_PLUGIN_EXPORT_HOSTS_FROM_FILE()

    #define             GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE(lower)

Convenient macro that exports plugin supported hosts from user provided config file.

#### Parameters

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

### GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE_WITH_FALLBACK()

    #define             GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE_WITH_FALLBACK(lower, ...)

Convenient macro that exports plugin supported hosts from user provided config file and if it does not exists uses hardcoded list of hosts as fallback.

#### Parameters

lower | lowercase name of the website, with multiple words separated by `_`. |
... | `NULL` terminated list of supported hosts. |

### GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE_WITH_PREPEND()

    #define             GTUBER_WEBSITE_PLUGIN_EXPORT_HOSTS_FROM_FILE_WITH_PREPEND(lower, ...)

Convenient macro that exports plugin supported hosts from user provided config file with prepended additional hosts without touching said file.

#### Parameters

lower | lowercase name of the website, with multiple words separated by `_`. |
... | `NULL` terminated list of supported hosts. |

### gtuber_website_get_uri ()

    GUri *
    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,
                            GUri *uri);

Sets new URI for handling. URI cannot be `NULL`.

This is mainly useful together with reconfigure flow event.

#### Parameters

website | a GtuberWebsite |
uri | a media source URI |

### gtuber_website_get_uri_string ()

    const gchar *
    gtuber_website_get_uri_string (GtuberWebsite *website);

#### Parameters

website | a GtuberWebsite |

#### Returns

current requested URI as string.

[transfer none]

### gtuber_website_set_uri_from_string ()

    gboolean
    gtuber_website_set_uri_from_string (GtuberWebsite *website,
                                        const gchar *uri_str,
                                        GError **error);

Sets URI from string for handling.

This is mainly useful together with reconfigure flow event.

#### Parameters

website | a GtuberWebsite |
uri_str | a media source URI as string |
error | return location for a GError, or `NULL`. | [nullable]

### gtuber_website_get_cookies_jar ()

    SoupCookieJar *
    gtuber_website_get_cookies_jar (GtuberWebsite *website);

Get SoupCookieJar with user provided cookies.

Note that first call into this function causes blocking I/O as cookies are read. Next call will return the same jar, so its safe to use this function multiple times without getting a hold of the jar in the subclass.

#### Parameters

website | a GtuberWebsite |

#### Returns

A SoupCookieJar with user provided cookies or `NULL` when none.

[nullable][transfer none]

### 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;

      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_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

`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_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. |