Clapper.MediaItem

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

Subclasses:

None

Methods

Inherited:

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

Structs:

GObject.ObjectClass (5)

class

new (uri)

class

new_cached (uri, location)

class

new_from_file (file)

get_container_format ()

get_duration ()

get_id ()

get_suburi ()

get_timeline ()

get_title ()

get_uri ()

set_suburi (suburi)

Virtual Methods

Inherited:

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

Properties

Inherited:

Gst.Object (2)

Name

Type

Flags

Short Description

cache-location

str

w/co/en

container-format

str

r/en

duration

float

r/en

id

int

r/en

suburi

str

r/w/en

timeline

Clapper.Timeline

r/en

title

str

r/en

uri

str

r/w/co/en

Signals

Inherited:

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

Fields

Inherited:

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

Class Details

class Clapper.MediaItem(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

Clapper.MediaItemClass

Represents a media item.

A newly created media item must be added to player [class`Clapper`.Queue] first in order to be played.

classmethod new(uri)
Parameters:

uri (str) – a media URI

Returns:

a new Clapper.MediaItem.

Return type:

Clapper.MediaItem

Creates new Clapper.MediaItem from URI.

Use one of the URI protocols supported by plugins in #GStreamer installation. For local files you can use either “file” protocol or [ctor`Clapper`.MediaItem.new_from_file] method.

It is considered a programmer error trying to create new media item from invalid URI. If URI is valid, but unsupported by installed plugins on user system, [class`Clapper`.Player] will emit a [signal`Clapper`.Player::missing-plugin] signal upon playback.

classmethod new_cached(uri, location)
Parameters:
  • uri (str) – a media URI

  • location (str or None) – a path to downloaded file

Returns:

a new Clapper.MediaItem.

Return type:

Clapper.MediaItem

Same as [ctor`Clapper`.MediaItem.new], but allows to provide a location of a cache file where particular media at uri is supposed to be found.

File at location existence will be checked upon starting playback of created item. If cache file is not found, media item uri will be used as fallback. In this case when [property`Clapper`.Player:download-enabled] is set to True, item will be downloaded and cached again if possible.

New in version 0.8.

classmethod new_from_file(file)
Parameters:

file (Gio.File) – a Gio.File

Returns:

a new Clapper.MediaItem.

Return type:

Clapper.MediaItem

Creates new Clapper.MediaItem from Gio.File.

Same as [ctor`Clapper`.MediaItem.new], but uses a [iface`Gio`.File] for convenience in some situations instead of an URI.

get_container_format()
Returns:

media container format.

Return type:

str or None

Get media item container format.

get_duration()
Returns:

media duration.

Return type:

float

Get media item duration as decimal number in seconds.

get_id()
Returns:

an ID of Clapper.MediaItem.

Return type:

int

Get the unique ID of Clapper.MediaItem.

get_suburi()
Returns:

an additional URI of Clapper.MediaItem.

Return type:

str or None

Get the additional URI of Clapper.MediaItem.

get_timeline()
Returns:

a Clapper.Timeline of item.

Return type:

Clapper.Timeline

Get the [class`Clapper`.Timeline] assosiated with self.

get_title()
Returns:

media title.

Return type:

str or None

Get media item title.

The title can be either text detected by media discovery once it completes. Otherwise whenever possible this will try to return a title extracted from media URI e.g. basename without extension for local files.

get_uri()
Returns:

an URI of Clapper.MediaItem.

Return type:

str

Get the URI of Clapper.MediaItem.

set_suburi(suburi)
Parameters:

suburi (str) – an additional URI

Set the additional URI of Clapper.MediaItem.

This is typically used to add an external subtitles URI to the self.

Property Details

Clapper.MediaItem.props.cache_location
Name:

cache-location

Type:

str

Default Value:

None

Flags:

WRITABLE, CONSTRUCT_ONLY, EXPLICIT_NOTIFY

Media downloaded cache file location.

New in version 0.8.

Clapper.MediaItem.props.container_format
Name:

container-format

Type:

str

Default Value:

None

Flags:

READABLE, EXPLICIT_NOTIFY

Media container format.

Clapper.MediaItem.props.duration
Name:

duration

Type:

float

Default Value:

0.0

Flags:

READABLE, EXPLICIT_NOTIFY

Media duration as a decimal number in seconds.

Clapper.MediaItem.props.id
Name:

id

Type:

int

Default Value:

4294967295

Flags:

READABLE, EXPLICIT_NOTIFY

Media Item ID.

Clapper.MediaItem.props.suburi
Name:

suburi

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Media additional URI.

Clapper.MediaItem.props.timeline
Name:

timeline

Type:

Clapper.Timeline

Default Value:

None

Flags:

READABLE, EXPLICIT_NOTIFY

Media timeline.

Clapper.MediaItem.props.title
Name:

title

Type:

str

Default Value:

None

Flags:

READABLE, EXPLICIT_NOTIFY

Media title.

Clapper.MediaItem.props.uri
Name:

uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY, EXPLICIT_NOTIFY

Media URI.