1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Fix bugs?

This commit is contained in:
Steffo 2020-05-03 01:53:15 +02:00
parent 32019a15ae
commit 6053b2ef5a
2 changed files with 15 additions and 14 deletions

View file

@ -29,8 +29,10 @@ class ApiFiorygiGetStar(ApiStar):
transactions: JSON = sorted(fiorygi.transactions, key=lambda t: -t.id) transactions: JSON = sorted(fiorygi.transactions, key=lambda t: -t.id)
return { return {
"fiorygi": fiorygi.fiorygi, "fiorygi": fiorygi.fiorygi,
"transactions": list(map(lambda t: {"id": t.id, "transactions": list(map(lambda t: {
"change": t.change, "id": t.id,
"reason": t.reason, "change": t.change,
"timestamp": t.timestamp.isoformat()}, transactions)) "reason": t.reason,
"timestamp": t.timestamp.isoformat() if t.timestamp else None
}, transactions))
} }

View file

@ -32,16 +32,15 @@ class RoyalPool(Playable):
else: else:
self.remaining_pool = self.full_pool.copy() self.remaining_pool = self.full_pool.copy()
random.shuffle(self.remaining_pool) random.shuffle(self.remaining_pool)
else: log.debug(f"Dequeuing an item...")
log.debug(f"Dequeuing an item...") # Get the first YtdlDiscord of the queue
# Get the first YtdlDiscord of the queue self.now_playing: YtdlDiscord = self.remaining_pool.pop(0)
self.now_playing: YtdlDiscord = self.remaining_pool.pop(0) log.debug(f"Yielding FileAudioSource from: {self.now_playing}")
log.debug(f"Yielding FileAudioSource from: {self.now_playing}") # Create a FileAudioSource from the YtdlDiscord
# Create a FileAudioSource from the YtdlDiscord # If the file hasn't been fetched / downloaded / converted yet, it will do so before yielding
# If the file hasn't been fetched / downloaded / converted yet, it will do so before yielding async with self.now_playing.spawn_audiosource() as fas:
async with self.now_playing.spawn_audiosource() as fas: # Yield the resulting AudioSource
# Yield the resulting AudioSource yield fas
yield fas
async def destroy(self): async def destroy(self):
for file in self.full_pool: for file in self.full_pool: