pylav.players package

Subpackages

Submodules

pylav.players.manager module

pylav.players.player module

pylav.players.utils module

class pylav.players.utils.PlayerQueue(maxsize=0)[source]

Bases: Queue[ANY_GENERIC_TYPE]

A queue, useful for coordinating producer and consumer coroutines.

If maxsize is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then “await put()” will block when the queue reaches maxsize, until an item is removed by get().

Unlike the standard library Queue, you can reliably know this Queue’s size with qsize(), since your single-threaded asyncio application won’t be interrupted between calling qsize() and doing an operation on the Queue.

clear()[source]

Remove all items from the queue

empty()[source]

Return True if the queue is empty, False otherwise

full()[source]

Return True if there are maxsize items in the queue.

Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True.

async get(index=None)[source]

Remove and return an item from the queue.

If queue is empty, wait until an item is available.

get_nowait(index=None)[source]

Remove and return an item from the queue.

Return an item if one is immediately available, else raise QueueEmpty.

async get_oldest()[source]

Remove and return an item from the queue.

If queue is empty, wait until an item is available.

index(value)[source]

Return first index of value

async join()[source]

Block until all items in the queue have been gotten and processed.

The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks.

property maxsize

Number of items allowed in the queue

popindex(index)[source]
async put(items, index=None, discard=False)[source]

Put an item into the queue.

Put an item into the queue. If the queue is full, wait until a free slot is available before adding item.

put_nowait(items, index=None)[source]

Put an item into the queue without blocking.

If no free slot is immediately available, raise QueueFull.

qsize()[source]

Number of items in the queue

raw_b64s
property raw_queue
async remove(value, duplicates=False)[source]

Removes the first occurrence of a value from the queue.

If duplicates is True, all occurrences of the value are removed. Returns the removed entries and number of occurrences removed.

async shuffle()[source]

Shuffle the queue

size()

Number of items in the queue

task_done()[source]

Indicate that a formerly enqueued task is complete.

Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete.

If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue).

Raises ValueError if called more times than there were items placed in the queue.

class pylav.players.utils.TrackHistoryQueue(maxsize=0)[source]

Bases: PlayerQueue[ANY_GENERIC_TYPE], ABC

get_nowait(index=None)[source]

Remove and return an item from the queue.

Return an item if one is immediately available, else raise QueueEmpty.

put_nowait(items, index=None)[source]

Put an item into the queue without blocking.

If no free slot is immediately available, raise QueueFull.

raw_b64s

Module contents