Queue#

The Queue object automatically plays the next song when the current one is done playing. Queue inherits from list so all of the list’s methods can be used (ex. pop(), append(), __iter__())

class songbird.queue.Queue(driver: Driver, on_next: Optional[Callable[[Driver, Any], Awaitable[None]]] = None, on_fail: Optional[Callable[[Driver, Any], Awaitable[None]]] = None)#

Bases: list

Parameters

driver (Driver) – The driver to control.

track_handle#

The TrackHandle for the currently playing song.

Type

Optional[TrackHandle]

running#

If the Queue is running or not. This will be True if the Queue isn’t stopped.

Type

bool

on_next#

Function called when the next song in the queue starts playing.

Type

Callable[[Driver, Any], Awaitable[None]], default=None

on_fail#

Function called when a song failed to play.

Type

Callable[[Driver, Any], Awaitable[None]], default=None

append(self, _Queue__object: T) None#

Append object to the end of the list.

clear(self, /)#

Remove all items from list.

copy(self, /)#

Return a shallow copy of the list.

count(self, value, /)#

Return number of occurrences of value.

extend(self, _Queue__iterable: Iterable[T]) None#

Extend list by appending elements from the iterable.

index(self, value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

insert(self, _Queue__index: SupportsIndex, _Queue__object: T) None#

Insert object before index.

pop(self, index=-1, /)#

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(self, value, /)#

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse(self, /)#

Reverse IN PLACE.

skip(self)#

Plays the next track in the queue

sort(self, /, *, key=None, reverse=False)#

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.

async start(self) None#

Starts the queue. Does not need to be called manually.

async stop(self) None#

Stops the queue from running. Does not stop the currently playing song.