1
0
Fork 0
mirror of synced 2024-06-03 03:04:33 +12:00

Use the new method for adding songs

This commit is contained in:
Phxntxm 2017-07-02 22:18:51 -05:00
parent 086b7f660b
commit 56ca4dabf2

View file

@ -39,14 +39,22 @@ class DJ(Playlist):
self.member = member self.member = member
self.playlists = [] self.playlists = []
async def get_next_entry(self, predownload_next=True): async def next_entry(self):
if not self.entries: """Get the next song in the playlist; this class will wait until the next song is ready"""
return None entry = self.peek()
else:
entry = self.entries[0] # While we have an entry available
self.entries.rotate(-1) while entry:
fut = entry.get_ready_future() # Check if we are ready or if we've errored, either way we'll pop it from the deque
return fut, await fut if entry.ready or entry.error:
self.entries.rotate(-1)
return entry
# Otherwise, wait a second and check again
else:
await asyncio.sleep(1)
# If we've reached here, we have no entries
return None
async def resolve_playlist(self): async def resolve_playlist(self):
self.playlists = self.bot.db.load('user_playlists', key=self.member.id, pluck='playlists') or [] self.playlists = self.bot.db.load('user_playlists', key=self.member.id, pluck='playlists') or []