RB.ShellPlayer

g GObject.Object GObject.Object RB.ShellPlayer RB.ShellPlayer GObject.Object->RB.ShellPlayer

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new (db)
  add_play_order (name, description, order_type, hidden)
  do_next ()
  do_previous ()
  get_active_source ()
  get_mute ()
  get_playback_state ()
  get_playing ()
  get_playing_entry ()
  get_playing_path ()
  get_playing_song_duration ()
  get_playing_source ()
  get_playing_time ()
  get_playing_time_string ()
  get_volume ()
  jump_to_current ()
  pause ()
  play ()
  play_entry (entry, source)
  playpause ()
  remove_play_order (name)
  seek (offset)
  set_mute (mute)
  set_playback_state (shuffle, repeat)
  set_playing_source (source)
  set_playing_time (time)
  set_selected_source (source)
  set_volume (volume)
  set_volume_relative (delta)
  stop ()

Virtual Methods

Inherited:GObject.Object (7)
  do_elapsed_changed (elapsed)
  do_elapsed_nano_changed (elapsed)
  do_playing_changed (playing)
  do_playing_song_changed (entry)
  do_playing_song_property_changed (uri, property, old, newValue)
  do_playing_source_changed (source)
  do_playing_uri_changed (uri)
  do_window_title_changed (window_title)

Properties

Name Type Flags Short Description
db RB.RhythmDB r/w/co RB.RhythmDB object
has-next bool r Whether there is a next track
has-prev bool r Whether there is a previous track
mute bool r/w Whether playback is muted
play-order str r What play order to use
player GObject.Object r RB.Player object
playing bool r Whether Rhythmbox is currently playing
playing-from-queue bool r Whether playing from the play queue or not
queue-only bool r/w Activation only adds to queue
queue-source RB.PlaylistSource r/w RBPlayQueueSource object
source RB.Source r/w RB.Source object
volume float r/w Current playback volume

Signals

Inherited:GObject.Object (1)
Name Short Description
elapsed-changed Emitted when the playback position changes.
elapsed-nano-changed Emitted when the playback position changes.
playing-changed Emitted when playback either stops or starts.
playing-song-changed Emitted when the playing database entry changes
playing-song-property-changed Emitted when a property of the playing database entry changes.
playing-source-changed Emitted when a new RB.Source instance starts playing
playing-uri-changed Emitted when the playing database entry changes, providing the URI of the entry.
window-title-changed Emitted when the main window title text should be changed

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class RB.ShellPlayer(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:RB.ShellPlayerClass
classmethod new(db)
Parameters:db (RB.RhythmDB) – the RB.RhythmDB
Returns:the RB.ShellPlayer instance
Return type:RB.ShellPlayer

Creates the RB.ShellPlayer

add_play_order(name, description, order_type, hidden)
Parameters:
  • name (str) – name of the new play order
  • description (str) – description of the new play order
  • order_type (GObject.GType) – the GObject.GType of the play order class
  • hidden (bool) – if True, don’t display the play order in the UI

Adds a new play order to the set of available play orders.

do_next()
Raises:GLib.Error
Returns:True if successful
Return type:bool

Skips to the next song. Consults the play queue and handles transitions between the play queue and the active source. Fails if there is no entry to play after the current one.

do_previous()
Raises:GLib.Error
Returns:True if successful
Return type:bool

If the current song has been playing for more than 3 seconds, restarts it, otherwise, goes back to the previous song. Fails if there is no current song, or if inside the first 3 seconds of the first song in the play order.

get_active_source()
Returns:the active RB.Source
Return type:RB.Source

Retrieves the active source. This is the source that the user selected for playback.

get_mute()
Raises:GLib.Error
Returns:True if currently muted
mute:returns the current mute setting
Return type:(bool, mute: bool)

Returns True if currently muted

get_playback_state()
Returns:True if successful.
shuffle:returns the current shuffle setting
repeat:returns the current repeat setting
Return type:(bool, shuffle: bool, repeat: bool)

Retrieves the current state of the shuffle and repeat settings.

get_playing()
Raises:GLib.Error
Returns:True if successful
playing:playback state return
Return type:(bool, playing: bool)

Reports whether playback is occuring by setting #playing.

get_playing_entry()
Returns:the currently playing RB.RhythmDBEntry, or None
Return type:RB.RhythmDBEntry or None

Retrieves the currently playing RB.RhythmDBEntry, or None if nothing is playing. The caller must unref the entry (using RB.RhythmDBEntry.unref) when it is no longer needed.

get_playing_path()
Raises:GLib.Error
Returns:True if successful
path:returns the URI of the current playing entry
Return type:(bool, path: str)

Retrieves the URI of the current playing entry. The caller must not free the returned string.

get_playing_song_duration()
Returns:duration, or -1 if not playing
Return type:int

Retrieves the duration of the current playing song.

get_playing_source()
Returns:the current playing RB.Source
Return type:RB.Source

Retrieves the current playing source. That is, the source from which the current song was drawn. This differs from RB.ShellPlayer.get_active_source when the current song came from the play queue.

get_playing_time()
Raises:GLib.Error
Returns:True if successful
time:returns the current playback position
Return type:(bool, time: int)

Retrieves the current playback position. Fails if the player currently cannot provide the playback position.

get_playing_time_string()
Returns:allocated playing time string
Return type:str

Constructs a string showing the current playback position, taking the time display settings into account.

get_volume()
Raises:GLib.Error
Returns:the current volume level.
volume:returns the volume level
Return type:(bool, volume: float)

Returns the current volume level

jump_to_current()
pause()
Raises:GLib.Error
Returns:whether playback is not occurring (True when successfully paused/stopped or playback was not occurring).
Return type:bool

Pauses playback if possible, completely stopping if not.

play()
Raises:GLib.Error
Returns:whether playback is now occurring (True when successfully started or already playing).
Return type:bool

Starts playback, if it is not already playing.

play_entry(entry, source)
Parameters:

Plays a specified entry.

playpause()
Raises:GLib.Error
Returns:True if successful
Return type:bool

Toggles between playing and paused state. If there is no playing entry, chooses an entry from (in order of preference) the play queue, the selection in the current source, or the play order.

remove_play_order(name)
Parameters:name (str) – name of the play order to remove

Removes a play order previously added with RB.ShellPlayer.add_play_order from the set of available play orders.

seek(offset)
Parameters:offset (int) – relative seek target (in seconds)
Raises:GLib.Error
Returns:True if successful
Return type:bool

Seeks forwards or backwards in the current playing song. Fails if the current song is not seekable.

set_mute(mute)
Parameters:mute (bool) – True to mute playback
Raises:GLib.Error
Returns:True if successful
Return type:bool

Updates the mute setting on the player.

set_playback_state(shuffle, repeat)
Parameters:
  • shuffle (bool) – whether to enable the shuffle setting
  • repeat (bool) – whether to enable the repeat setting

Sets the state of the shuffle and repeat settings.

set_playing_source(source)
Parameters:source (RB.Source) – the new playing RB.Source

Replaces the current playing source.

set_playing_time(time)
Parameters:time (int) – the target playback position (in seconds)
Raises:GLib.Error
Returns:True if successful
Return type:bool

Attempts to set the playback position. Fails if the current song is not seekable.

set_selected_source(source)
Parameters:source (RB.Source) – the RB.Source to select

Updates the player to reflect a new source being selected.

set_volume(volume)
Parameters:volume (float) – the volume level (between 0 and 1)
Raises:GLib.Error
Returns:True on success
Return type:bool

Sets the playback volume level.

set_volume_relative(delta)
Parameters:delta (float) – difference to apply to the volume level (between -1 and 1)
Raises:GLib.Error
Returns:True on success
Return type:bool

Adds the specified value to the current volume level.

stop()

Completely stops playback, freeing resources and unloading the file.

In general RB.ShellPlayer.pause() should be used instead, as it stops the audio, but does not completely free resources.

do_elapsed_changed(elapsed) virtual
Parameters:elapsed (int) –
do_elapsed_nano_changed(elapsed) virtual
Parameters:elapsed (int) –
do_playing_changed(playing) virtual
Parameters:playing (bool) –
do_playing_song_changed(entry) virtual
Parameters:entry (RB.RhythmDBEntry) –
do_playing_song_property_changed(uri, property, old, newValue) virtual
Parameters:
do_playing_source_changed(source) virtual
Parameters:source (RB.Source) –
do_playing_uri_changed(uri) virtual
Parameters:uri (str) –
do_window_title_changed(window_title) virtual
Parameters:window_title (str) –

Signal Details

RB.ShellPlayer.signals.elapsed_changed(shell_player, elapsed)
Signal Name:

elapsed-changed

Flags:

RUN_LAST

Parameters:
  • shell_player (RB.ShellPlayer) – The object which received the signal
  • elapsed (int) – the new playback position in seconds

Emitted when the playback position changes.

RB.ShellPlayer.signals.elapsed_nano_changed(shell_player, elapsed)
Signal Name:

elapsed-nano-changed

Flags:

RUN_LAST

Parameters:
  • shell_player (RB.ShellPlayer) – The object which received the signal
  • elapsed (int) – the new playback position in nanoseconds

Emitted when the playback position changes. Only use this (as opposed to elapsed-changed) when you require subsecond precision. This signal will be emitted multiple times per second.

RB.ShellPlayer.signals.playing_changed(shell_player, playing)
Signal Name:

playing-changed

Flags:

RUN_LAST

Parameters:
  • shell_player (RB.ShellPlayer) – The object which received the signal
  • playing (bool) – flag indicating playback state

Emitted when playback either stops or starts.

RB.ShellPlayer.signals.playing_song_changed(shell_player, entry)
Signal Name:

playing-song-changed

Flags:

RUN_LAST

Parameters:

Emitted when the playing database entry changes

RB.ShellPlayer.signals.playing_song_property_changed(shell_player, uri, property, old, newvalue)
Signal Name:

playing-song-property-changed

Flags:

RUN_LAST

Parameters:
  • shell_player (RB.ShellPlayer) – The object which received the signal
  • uri (str) – the URI of the playing entry
  • property (str) – the name of the property that changed
  • old (GObject.Value) – the previous value for the property
  • newvalue (GObject.Value) – the new value of the property

Emitted when a property of the playing database entry changes.

RB.ShellPlayer.signals.playing_source_changed(shell_player, source)
Signal Name:

playing-source-changed

Flags:

RUN_LAST

Parameters:

Emitted when a new RB.Source instance starts playing

RB.ShellPlayer.signals.playing_uri_changed(shell_player, uri)
Signal Name:

playing-uri-changed

Flags:

RUN_LAST

Parameters:
  • shell_player (RB.ShellPlayer) – The object which received the signal
  • uri (str) – the URI of the new playing entry

Emitted when the playing database entry changes, providing the URI of the entry.

RB.ShellPlayer.signals.window_title_changed(shell_player, title)
Signal Name:

window-title-changed

Flags:

RUN_LAST

Parameters:
  • shell_player (RB.ShellPlayer) – The object which received the signal
  • title (str) – the new window title

Emitted when the main window title text should be changed

Property Details

RB.ShellPlayer.props.db
Name:db
Type:RB.RhythmDB
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The RB.RhythmDB

RB.ShellPlayer.props.has_next
Name:has-next
Type:bool
Default Value:False
Flags:READABLE

Whether there is a track to play after the current track.

RB.ShellPlayer.props.has_prev
Name:has-prev
Type:bool
Default Value:False
Flags:READABLE

Whether there was a previous track before the current track.

RB.ShellPlayer.props.mute
Name:mute
Type:bool
Default Value:False
Flags:READABLE, WRITABLE

Whether playback is currently muted.

RB.ShellPlayer.props.play_order
Name:play-order
Type:str
Default Value:'linear'
Flags:READABLE

The current play order object.

RB.ShellPlayer.props.player
Name:player
Type:GObject.Object
Default Value:None
Flags:READABLE

The player backend object (an object implementing the RB.Player interface).

RB.ShellPlayer.props.playing
Name:playing
Type:bool
Default Value:False
Flags:READABLE

Whether Rhythmbox is currently playing something

RB.ShellPlayer.props.playing_from_queue
Name:playing-from-queue
Type:bool
Default Value:False
Flags:READABLE

If True, the current playing entry came from the play queue.

RB.ShellPlayer.props.queue_only
Name:queue-only
Type:bool
Default Value:False
Flags:READABLE, WRITABLE

If True, activating an entry should only add it to the play queue.

RB.ShellPlayer.props.queue_source
Name:queue-source
Type:RB.PlaylistSource
Default Value:None
Flags:READABLE, WRITABLE

The play queue source

RB.ShellPlayer.props.source
Name:source
Type:RB.Source
Default Value:None
Flags:READABLE, WRITABLE

The current source that is selected for playback.

RB.ShellPlayer.props.volume
Name:volume
Type:float
Default Value:1.0
Flags:READABLE, WRITABLE

The current playback volume (between 0.0 and 1.0)