Totem.Object

g GObject.GInterface GObject.GInterface Gio.ActionGroup Gio.ActionGroup GObject.GInterface->Gio.ActionGroup Gio.ActionMap Gio.ActionMap GObject.GInterface->Gio.ActionMap GObject.Object GObject.Object Gio.Application Gio.Application GObject.Object->Gio.Application Gio.ActionGroup->Gio.Application Gio.ActionMap->Gio.Application Gtk.Application Gtk.Application Gio.Application->Gtk.Application Totem.Object Totem.Object Gtk.Application->Totem.Object

Subclasses:None

Methods

Inherited:Gtk.Application (21), Gio.Application (37), GObject.Object (37), Gio.ActionGroup (14), Gio.ActionMap (4)
Structs:GObject.ObjectClass (5)
class get_supported_content_types ()
class get_supported_uri_schemes ()
  add_to_playlist (uri, display_name, play)
  add_to_view (file, title)
  can_seek_next ()
  can_seek_previous ()
  clear_playlist ()
  empty_menu_section (id)
  exit ()
  get_current_mrl ()
  get_current_time ()
  get_main_window ()
  get_menu_section (id)
  get_playlist_length ()
  get_playlist_pos ()
  get_rate ()
  get_short_title ()
  get_title_at_playlist_pos (playlist_index)
  get_video_widget ()
  get_volume ()
  is_fullscreen ()
  is_paused ()
  is_playing ()
  is_seekable ()
  next_angle ()
  pause ()
  play ()
  play_pause ()
  remote_command (cmd, url)
  remote_get_setting (setting)
  remote_set_setting (setting, value)
  seek_next ()
  seek_previous ()
  seek_relative (offset, accurate)
  seek_time (msec, accurate)
  set_current_subtitle (subtitle_uri)
  set_rate (rate)
  set_volume (volume)
  show_error (title, reason)
  stop ()

Properties

Inherited:Gtk.Application (5), Gio.Application (8)
Name Type Flags Short Description
current-content-type str r Current stream’s content-type.
current-display-name str r Current stream’s display name.
current-mrl str r The MRL of the current stream.
current-time int r The player’s position (time) in the current stream.
fullscreen bool r Whether Totem is in fullscreen mode.
main-page str r Current main page.
playing bool r Whether Totem is currently playing a file.
seekable bool r Whether the current stream is seekable.
stream-length int r The length of the current stream.

Signals

Inherited:Gtk.Application (3), Gio.Application (7), GObject.Object (1), Gio.ActionGroup (4)
Name Short Description
file-closed The Totem.Object ::file-closed signal is emitted when Totem closes a stream.
file-has-played The Totem.Object ::file-has-played signal is emitted when a new stream has started playing in Totem.
file-opened The Totem.Object ::file-opened signal is emitted when a new stream is opened by Totem.
get-text-subtitle The Totem.Object ::get-text-subtitle signal is emitted before opening a stream, so that plugins have the opportunity to detect or download text subtitles for the stream if necessary.
get-user-agent The Totem.Object ::get-user-agent signal is emitted before opening a stream, so that plugins have the opportunity to return the user-agent to be set.
metadata-updated The Totem.Object ::metadata-updated signal is emitted when the metadata of a stream is updated, typically when it’s being loaded.

Class Details

class Totem.Object(**kwargs)
Bases:Gtk.Application
Abstract:No
Structure:Totem.ObjectClass

All the fields in the Totem.Object structure are private and should never be accessed directly.

classmethod get_supported_content_types()
Returns:a None-terminated array of the content types Totem supports
Return type:[str]

Get the full list of file content types which Totem supports playing.

New in version 3.1.5.

classmethod get_supported_uri_schemes()
Returns:a None-terminated array of the URI schemes Totem supports
Return type:[str]

Get the full list of URI schemes which Totem supports accessing.

New in version 3.1.5.

add_to_playlist(uri, display_name, play)
Parameters:
  • uri (str) – the URI to add to the playlist
  • display_name (str) – the display name of the URI
  • play (bool) – whether to play the added item

Add uri to the playlist and play it immediately.

add_to_view(file, title)
Parameters:

Adds a local media file to the main view.

can_seek_next()
Return type:bool

Returns true if Totem.Object.seek_next() would have an effect.

can_seek_previous()
Return type:bool

Returns true if Totem.Object.seek_previous() would have an effect.

clear_playlist()

Empties the current playlist.

empty_menu_section(id)
Parameters:id (str) – the ID for the menu section to empty

Empty the Gio.Menu section pointed to by id, and remove any related actions. Note that menu items with specific target will not have the associated action removed.

exit()

Closes Totem.

get_current_mrl()
Returns:a newly-allocated string containing the MRL of the current stream
Return type:str

Get the MRL of the current stream, or None if nothing’s playing. Free with GLib.free().

get_current_time()
Returns:the current position in the stream
Return type:int

Gets the current position’s time in the stream as a gint64.

get_main_window()
Returns:Totem’s main window
Return type:Gtk.Window

Gets Totem’s main window and increments its reference count.

get_menu_section(id)
Parameters:id (str) – the ID for the menu section to look up
Returns:a Gio.Menu or None on failure
Return type:Gio.Menu or None

Get the Gio.Menu of the given id from the main Totem Gtk.Builder file.

get_playlist_length()
Returns:the playlist length
Return type:int

Returns the length of the current playlist.

get_playlist_pos()
Returns:the index of the current playlist entry, or -1
Return type:int

Returns the 0-based index of the current entry in the playlist. If there is no current entry in the playlist, -1 is returned.

get_rate()
Returns:the volume level
Return type:float

Gets the current playback rate, with 1.0 being the normal playback rate.

get_short_title()
Returns:the current entry’s title, or None; free with GLib.free()
Return type:str

Gets the title of the current entry in the playlist.

get_title_at_playlist_pos(playlist_index)
Parameters:playlist_index (int) – the 0-based entry index
Returns:the entry title at index, or None; free with GLib.free()
Return type:str

Gets the title of the playlist entry at index.

get_video_widget()
Returns:Totem’s video widget
Return type:Gtk.Widget

Gets Totem’s video widget and increments its reference count.

get_volume()
Returns:the volume level
Return type:float

Gets the current volume level, as a value between 0.0 and 1.0.

is_fullscreen()
Returns:True if Totem is fullscreened
Return type:bool

Returns True if Totem is fullscreened.

is_paused()
Returns:True if playback is paused, False otherwise
Return type:bool

Returns True if playback is paused.

is_playing()
Returns:True if Totem is playing a stream
Return type:bool

Returns True if Totem is playing a stream.

is_seekable()
Returns:True if the current stream is seekable
Return type:bool

Returns True if the current stream is seekable.

next_angle()

Switches to the next angle, if watching a DVD. If not watching a DVD, this is a no-op.

pause()

Pauses the current stream. If Totem is already paused, it continues to be paused.

play()

Plays the current stream. If Totem is already playing, it continues to play. If the stream cannot be played, and error dialog is displayed.

play_pause()

Gets the current MRL from the playlist and attempts to play it. If the stream is already playing, playback is paused.

remote_command(cmd, url)
Parameters:

Executes the specified cmd on this instance of Totem. If cmd is an operation requiring an MRL, url is required; it can be None otherwise.

If Totem’s fullscreened and the operation is executed correctly, the controls will appear as if the user had moved the mouse.

remote_get_setting(setting)
Parameters:setting (Totem.RemoteSetting) – a Totem.RemoteSetting
Returns:True if the setting is enabled, False otherwise
Return type:bool

Returns the value of setting for this instance of Totem.

remote_set_setting(setting, value)
Parameters:

Sets setting to value on this instance of Totem.

seek_next()

If a DVD is being played, goes to the next chapter. If a normal stream is being played, plays the next entry in the playlist.

seek_previous()

If a DVD is being played, goes to the previous chapter. If a normal stream is being played, goes to the start of the stream if possible. If seeking is not possible, plays the previous entry in the playlist.

seek_relative(offset, accurate)
Parameters:
  • offset (int) – the time offset to seek to
  • accurate (bool) – whether to use accurate seek, an accurate seek might be slower for some formats (see GStreamer docs)

Seeks to an offset from the current position in the stream, or displays an error dialog if that’s not possible.

seek_time(msec, accurate)
Parameters:
  • msec (int) – the time to seek to
  • accurate (bool) – whether to use accurate seek, an accurate seek might be slower for some formats (see GStreamer docs)

Seeks to an absolute time in the stream, or displays an error dialog if that’s not possible.

set_current_subtitle(subtitle_uri)
Parameters:subtitle_uri (str) – the URI of the subtitle file to add

Add the subtitle_uri subtitle file to the playlist, setting it as the subtitle for the current playlist entry.

set_rate(rate)
Parameters:rate (float) – the new absolute playback rate
Returns:True on success, False on failure.
Return type:bool

Sets the playback rate, with 1.0 being the normal playback rate.

set_volume(volume)
Parameters:volume (float) – the new absolute volume value

Sets the volume, with 1.0 being the maximum, and 0.0 being the minimum level.

show_error(title, reason)
Parameters:
  • title (str) – the error dialog title
  • reason (str) – the error dialog text

Displays a non-blocking error dialog with the given title and reason.

stop()

Stops playback, and sets the playlist back at the start.

do_file_closed() virtual
do_file_has_played(mrl) virtual
Parameters:mrl (str) –
do_file_opened(mrl) virtual
Parameters:mrl (str) –
do_get_text_subtitle(mrl) virtual
Parameters:mrl (str) –
Return type:str
do_get_user_agent(mrl) virtual
Parameters:mrl (str) –
Return type:str
do_metadata_updated(artist, title, album, track_num) virtual
Parameters:
  • artist (str) –
  • title (str) –
  • album (str) –
  • track_num (int) –

Signal Details

Totem.Object.signals.file_closed(object)
Signal Name:file-closed
Flags:RUN_LAST
Parameters:object (Totem.Object) – The object which received the signal

The Totem.Object ::file-closed signal is emitted when Totem closes a stream.

Totem.Object.signals.file_has_played(object, mrl)
Signal Name:

file-has-played

Flags:

RUN_LAST

Parameters:
  • object (Totem.Object) – The object which received the signal
  • mrl (str) – the MRL of the opened stream

The Totem.Object ::file-has-played signal is emitted when a new stream has started playing in Totem.

Totem.Object.signals.file_opened(object, mrl)
Signal Name:

file-opened

Flags:

RUN_LAST

Parameters:
  • object (Totem.Object) – The object which received the signal
  • mrl (str) – the MRL of the opened stream

The Totem.Object ::file-opened signal is emitted when a new stream is opened by Totem.

Totem.Object.signals.get_text_subtitle(object, mrl)
Signal Name:

get-text-subtitle

Flags:

RUN_LAST

Parameters:
  • object (Totem.Object) – The object which received the signal
  • mrl (str) – the MRL of the opened stream
Returns:

allocated string representing the URI of the subtitle to use for mrl

Return type:

str

The Totem.Object ::get-text-subtitle signal is emitted before opening a stream, so that plugins have the opportunity to detect or download text subtitles for the stream if necessary.

Totem.Object.signals.get_user_agent(object, mrl)
Signal Name:

get-user-agent

Flags:

RUN_LAST

Parameters:
  • object (Totem.Object) – The object which received the signal
  • mrl (str) – the MRL of the opened stream
Returns:

allocated string representing the user-agent to use for mrl

Return type:

str

The Totem.Object ::get-user-agent signal is emitted before opening a stream, so that plugins have the opportunity to return the user-agent to be set.

Totem.Object.signals.metadata_updated(object, artist, title, album, track_number)
Signal Name:

metadata-updated

Flags:

RUN_LAST

Parameters:
  • object (Totem.Object) – The object which received the signal
  • artist (str) – the name of the artist, or None
  • title (str) – the stream title, or None
  • album (str) – the name of the stream’s album, or None
  • track_number (int) – the stream’s track number

The Totem.Object ::metadata-updated signal is emitted when the metadata of a stream is updated, typically when it’s being loaded.

Property Details

Totem.Object.props.current_content_type
Name:current-content-type
Type:str
Default Value:None
Flags:READABLE

The content-type of the current stream.

Totem.Object.props.current_display_name
Name:current-display-name
Type:str
Default Value:None
Flags:READABLE

The display name of the current stream.

Totem.Object.props.current_mrl
Name:current-mrl
Type:str
Default Value:None
Flags:READABLE

The MRL of the current stream.

Totem.Object.props.current_time
Name:current-time
Type:int
Default Value:0
Flags:READABLE

The player’s position (time) in the current stream, in milliseconds.

Totem.Object.props.fullscreen
Name:fullscreen
Type:bool
Default Value:False
Flags:READABLE

If True, Totem is in fullscreen mode.

Totem.Object.props.main_page
Name:main-page
Type:str
Default Value:None
Flags:READABLE

The name of the current main page (usually “grilo”, or “player”).

Totem.Object.props.playing
Name:playing
Type:bool
Default Value:False
Flags:READABLE

If True, Totem is playing an audio or video file.

Totem.Object.props.seekable
Name:seekable
Type:bool
Default Value:False
Flags:READABLE

If True, the current stream is seekable.

Totem.Object.props.stream_length
Name:stream-length
Type:int
Default Value:0
Flags:READABLE

The length of the current stream, in milliseconds.