Player

Allows for playback and queue control

xl.player.PLAYER = None

The player singleton of ExailePlayer for playback control

ExailePlayer.play(track, **kwargs)

Starts the playback with the provided track or stops the playback it immediately if none

Parameters:track (xl.trax.Track) – the track to play

Note

The following events will be emitted by this method:

  • playback_player_start: indicates the start of playback overall
  • playback_track_start: indicates playback start of a track
ExailePlayer.stop(_fire=True, **kwargs)

Stops the playback

Parameters:fire – Send the ‘playback_player_end’ event. Used by engines to avoid spurious playback_end events. Not public API.

Note

The following events will be emitted by this method:

  • playback_player_end: indicates the end of playback overall
  • playback_track_end: indicates playback end of a track
ExailePlayer.pause()

Pauses the playback, does not toggle it

Note

The following events will be emitted by this method:

  • playback_player_pause: indicates that the playback has been paused
ExailePlayer.unpause()

Resumes the playback, does not toggle it

Note

The following events will be emitted by this method:

  • playback_player_resume: indicates that the playback has been resumed
ExailePlayer.toggle_pause()

Toggles between playing and paused state

Note

The following events will be emitted by this method:

  • playback_toggle_pause: indicates that the playback has been paused or resumed
ExailePlayer.seek(value)

Seek to a position in the currently playing stream

Parameters:value (int) – the position in seconds
ExailePlayer.get_position()

Gets the current playback position of the playing track

Returns:the playback position in nanoseconds
Return type:int
ExailePlayer.get_time()

Gets the current playback time

Returns:the playback time in seconds
Return type:int
ExailePlayer.get_progress()

Gets the current playback progress

Returns:the playback progress as [0..1]
Return type:float
ExailePlayer.set_progress(progress)

Seeks to the progress position

Parameters:progress (float) – value ranged at [0..1]
ExailePlayer.get_volume()

Gets the current volume

Returns:the volume percentage
Type:int
ExailePlayer.set_volume(volume)

Sets the current volume

Parameters:volume (int) – the volume percentage
ExailePlayer.get_state()

Gets the player state

Returns:one of playing, paused or stopped
Return type:string
ExailePlayer.is_playing()

Convenience method to find out if the player is currently playing

Returns:whether the player is currently playing
Return type:bool
ExailePlayer.is_paused()

Convenience method to find out if the player is currently paused

Returns:whether the player is currently paused
Return type:bool
ExailePlayer.is_stopped()

Convenience method to find out if the player is currently stopped

Returns:whether the player is currently stopped
Return type:bool
xl.player.QUEUE = <xl.player.queue.PlayQueue object at 0x7f34181d4d90>

Manages the queue of songs to be played

The content of the queue are processed before processing the content of the assigned playlist.

When the remove_item_when_played option is enabled, the queue removes items from itself as they are played.

When not enabled, the queue acts like a regular playlist, and moves the position as tracks are played.

In this mode, when a new track is queued, the position is set to play that track, and play will continue with that track until the queue is exhausted, and then the assigned playlist will be continued.

The queue singleton of PlayQueue

class xl.player.queue.PlayQueue(player, name, location=None)

Bases: xl.playlist.Playlist

Manages the queue of songs to be played

The content of the queue are processed before processing the content of the assigned playlist.

When the remove_item_when_played option is enabled, the queue removes items from itself as they are played.

When not enabled, the queue acts like a regular playlist, and moves the position as tracks are played.

In this mode, when a new track is queued, the position is set to play that track, and play will continue with that track until the queue is exhausted, and then the assigned playlist will be continued.

get_current()

Gets the current track

Returns:the current track
Type:xl.trax.Track
get_next()

Retrieves the next track that will be played. Does not actually set the position. When you call next(), it should return the same track.

This exists to support retrieving a track before it actually needs to be played, such as for pre-buffering.

Returns:the next track to be played
Return type:xl.trax.Track or None
is_play_enabled()
Returns:True when calling play() will have no effect
next(autoplay=True, track=None)

Goes to the next track, either in the queue, or in the current playlist. If a track is passed in, that track is played

Parameters:
  • autoplay (bool) – play the track in addition to returning it
  • track (xl.trax.Track) – if passed, play this track

Note

The following events will be emitted by this method:

  • playback_playlist_end: indicates that the end of the queue has been reached
play(track=None)

Starts queue processing with the given track preceding the queue content

Parameters:track (xl.trax.Track) – the track to play
prev()

Goes to the previous track

queue_length()

Returns the number of tracks left to play in the queue’s internal playlist.

set_current_playlist(playlist)

Sets the playlist to be processed in the queue

Parameters:playlist (xl.playlist.Playlist) – the playlist to process

Note

The following events will be emitted by this method:

  • queue_current_playlist_changed: indicates that the queue playlist has been changed
current_playlist

The playlist currently processed in the queue