update sources on repeat
This commit is contained in:
parent
77c0f16da3
commit
b2dc8c5edb
@ -162,6 +162,7 @@ def get_of(mainservice: MainService, defaulteffects: DefaultEffects) -> Callable
|
|||||||
audio = queue.queue[0]
|
audio = queue.queue[0]
|
||||||
for _ in range(n):
|
for _ in range(n):
|
||||||
queue.queue.insert(1, audio.copy())
|
queue.queue.insert(1, audio.copy())
|
||||||
|
queue.update_sources()
|
||||||
|
|
||||||
@at('branch')
|
@at('branch')
|
||||||
async def branch(ctx: Context, args: list[str]):
|
async def branch(ctx: Context, args: list[str]):
|
||||||
|
@ -22,7 +22,7 @@ class QueueAudio(discord.AudioSource):
|
|||||||
self.guild = guild
|
self.guild = guild
|
||||||
self.loop = asyncio.get_running_loop()
|
self.loop = asyncio.get_running_loop()
|
||||||
|
|
||||||
def _update_sources(self):
|
def update_sources(self):
|
||||||
for i in range(PRE_SET_LENGTH):
|
for i in range(PRE_SET_LENGTH):
|
||||||
try:
|
try:
|
||||||
self.queue[i].set_source_if_necessary()
|
self.queue[i].set_source_if_necessary()
|
||||||
@ -63,7 +63,7 @@ class QueueAudio(discord.AudioSource):
|
|||||||
def _popleft(self, audio: YTAudio):
|
def _popleft(self, audio: YTAudio):
|
||||||
if self.queue and self.queue[0] is audio:
|
if self.queue and self.queue[0] is audio:
|
||||||
self.queue.popleft().cleanup()
|
self.queue.popleft().cleanup()
|
||||||
self._update_sources()
|
self.update_sources()
|
||||||
|
|
||||||
def read(self) -> bytes:
|
def read(self) -> bytes:
|
||||||
for i in range(len(self.queue)):
|
for i in range(len(self.queue)):
|
||||||
@ -94,7 +94,7 @@ class QueueAudio(discord.AudioSource):
|
|||||||
self.queue.remove(audio)
|
self.queue.remove(audio)
|
||||||
audio.cleanup()
|
audio.cleanup()
|
||||||
return True
|
return True
|
||||||
self._update_sources()
|
self.update_sources()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def clear(self, member: discord.Member) -> None:
|
def clear(self, member: discord.Member) -> None:
|
||||||
@ -112,7 +112,7 @@ class QueueAudio(discord.AudioSource):
|
|||||||
if max(a, b) >= len(self.queue):
|
if max(a, b) >= len(self.queue):
|
||||||
return
|
return
|
||||||
self.queue[a], self.queue[b] = self.queue[b], self.queue[a]
|
self.queue[a], self.queue[b] = self.queue[b], self.queue[a]
|
||||||
self._update_sources()
|
self.update_sources()
|
||||||
|
|
||||||
def move(self, member: discord.Member, a: int, b: int) -> None:
|
def move(self, member: discord.Member, a: int, b: int) -> None:
|
||||||
assert_admin(member)
|
assert_admin(member)
|
||||||
@ -121,7 +121,7 @@ class QueueAudio(discord.AudioSource):
|
|||||||
audio = self.queue[a]
|
audio = self.queue[a]
|
||||||
self.queue.remove(audio)
|
self.queue.remove(audio)
|
||||||
self.queue.insert(b, audio)
|
self.queue.insert(b, audio)
|
||||||
self._update_sources()
|
self.update_sources()
|
||||||
|
|
||||||
async def format(self) -> str:
|
async def format(self) -> str:
|
||||||
stream = StringIO()
|
stream = StringIO()
|
||||||
|
Loading…
Reference in New Issue
Block a user