Clapper.Harvest

g Clapper.Harvest Clapper.Harvest GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Object->Clapper.Harvest

Subclasses:

None

Methods

Inherited:

Gst.Object (29), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

fill (media_type, data)

fill_with_bytes (media_type, bytes)

fill_with_text (media_type, text)

headers_set (key, value)

set_expiration_date_utc (date_utc)

set_expiration_seconds (seconds)

tags_add (tag, value)

toc_add (type, title, start, end)

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

Properties

Inherited:

Gst.Object (2)

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Class Details

class Clapper.Harvest(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

Clapper.HarvestClass

An object storing data from enhancers that implement [iface`Clapper`.Extractable] interface.

New in version 0.8.

fill(media_type, data)
Parameters:
  • media_type (str) – media mime type

  • data (bytes) – data to fill self

Returns:

True when filled successfully, False if taken data was empty.

Return type:

bool

Fill harvest with extracted data. It can be anything that GStreamer can parse and play such as single URI or a streaming manifest.

Calling again this function will replace previously filled content.

Commonly used media types are:

  • application/dash+xml - DASH manifest

  • application/x-hls - HLS manifest

  • text/x-uri - direct media URI

  • text/uri-list - playlist of URIs

  • application/clapper-playlist - custom playlist format

New in version 0.8.

fill_with_bytes(media_type, bytes)
Parameters:
Returns:

True when filled successfully, False if taken data was empty.

Return type:

bool

A convenience method to fill self with data from GLib.Bytes.

For more info, see [method`Clapper`.Harvest.fill] documentation.

New in version 0.8.

fill_with_text(media_type, text)
Parameters:
  • media_type (str) – media mime type

  • text (str) – data to fill self as None terminated string

Returns:

True when filled successfully, False if taken data was empty.

Return type:

bool

A convenience method to fill self using a None terminated string.

For more info, see [method`Clapper`.Harvest.fill] documentation.

New in version 0.8.

headers_set(key, value)
Parameters:

Set another header in the request headers list using GObject.Value.

Setting again the same key will update its value to the new one.

New in version 0.8.

set_expiration_date_utc(date_utc)
Parameters:

date_utc (GLib.DateTime) – a GLib.DateTime in UTC time

Set date in UTC time until harvested content is expected to stay alive.

This is used for harvest caching, so next time user requests to play the same URI, recently harvested data can be reused without the need to run [vfunc`Clapper`.Extractable.extract] again.

New in version 0.10.

set_expiration_seconds(seconds)
Parameters:

seconds (float) – time in seconds until expiration

Set amount of seconds for how long harvested content is expected to stay alive.

Alternative function to [method`Clapper`.Harvest.set_expiration_date_utc], but takes time as number in seconds from now.

It is safe to pass zero or negative number to this function in case when calculating time manually and it already expired.

New in version 0.10.

tags_add(tag, value)
Parameters:

Append another tag into the tag list using GObject.Value.

New in version 0.8.

toc_add(type, title, start, end)
Parameters:

Append a chapter or track name into table of contents.

New in version 0.8.