- Added multi threading to all intents that enqueue songs, skill responds much faster and combats issues with timeouts

- Resolves #61
This commit is contained in:
Ross Stewart
2025-09-08 13:04:23 +01:00
parent 39831cc32b
commit 71176626dc
2 changed files with 161 additions and 26 deletions

View File

@@ -40,6 +40,64 @@ class MediaQueue:
self.current_track: Track = Track()
"""Property to hold the current track object"""
def get_current_track(self) -> Track:
"""Method to return current_track attribute
Added to allow access to the current_track object while using BaseManager
for multi threading, as BaseManager does not allow access to class
attributes / properties
:return: A Track object representing the current playing audio track
:rtype: Track
"""
return self.current_track
def set_current_track_offset(self, offset: int) -> None:
"""Method to set the offset of the current track in milliseconds
Set the offset for the current track in milliseconds. This is used
when resuming a paused track to ensure the track isn't played from
the beginning again.
:param offset: The track offset in milliseconds
:type offset: int
"""
self.current_track.offset = offset
def get_current_queue(self) -> deque:
"""Get the current queue
Returns a deque containing the current queue of music to be played
:return: The current queue
:rtype: deque
"""
return self.queue
def get_buffer(self) -> deque:
"""Get the buffer
Returns a deque containing the current buffer
:return: The current buffer
:rtype: deque
"""
return self.buffer
def get_history(self) -> deque:
"""Get history
Returns a deque of tracks that have already been played
:return: A deque container tracks that have already been played
:rtype: deque
"""
return self.history
def add_track(self, track: Track) -> None:
"""Add tracks to the queue