Queue¶
- class pomice.queue.Queue(max_size: int | None = None, *, overflow: bool = True)[source]¶
Bases:
Iterable[Track]Queue for Pomice. This queue takes pomice.Track as an input and includes looping and shuffling.
- property count: int¶
Returns queue member count.
- disable_loop() None[source]¶
Disables loop mode if set. Raises QueueException if loop mode is already None.
- extend(iterable: Iterable[Track], *, atomic: bool = True) None[source]¶
Add the members of the given iterable to the end of the queue. If atomic is set to True, no tracks will be added upon any exceptions. If atomic is set to False, as many tracks will be added as possible. When overflow is enabled for the queue, atomic=True won’t prevent dropped items.
- find_position(item: Track) int[source]¶
Find the position a given item within the queue. Raises ValueError if item is not in queue.
- get() Track[source]¶
Return next immediately available item in queue if any. Raises QueueEmpty if no items in queue.
- property is_empty: bool¶
Returns True if queue has no members.
- property is_full: bool¶
Returns True if queue item count has reached max_size.
- property is_looping: bool¶
Returns True if the queue is looping either a track or the queue
- jump(item: Track) None[source]¶
Jumps to the item specified in the queue.
If the queue is not looping, the queue will be mutated. Otherwise, the current item will be adjusted to the item before the specified track.
The queue is adjusted so that the next item that is retrieved is the track that is specified, effectively ‘jumping’ the queue.
- max_size: int | None¶
- pop() Track[source]¶
Return item from the right end side of the queue. Raises QueueEmpty if no items in queue.
- put_at_index(index: int, item: Track) None[source]¶
Put the given item into the queue at the specified index.
- remove(item: Track) None[source]¶
Removes a item within the queue. Raises ValueError if item is not in queue.
- set_loop_mode(mode: LoopMode) None[source]¶
Sets the loop mode of the queue. Takes the LoopMode enum as an argument.
- property size: int¶
Returns the amount of items in the queue