mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Merge pull request #5 from RafaelSolVargas/fixing-spotify-bug
Fixing Error #4
This commit is contained in:
commit
e82fc8c2f6
@ -95,11 +95,27 @@ class Music(commands.Cog):
|
||||
await self.__send_embed(ctx, description=f"Você adicionou {songs_quant} músicas à fila!", colour_name='blue')
|
||||
|
||||
if not self.__playing:
|
||||
first = self.__playlist.songs_to_preload[0]
|
||||
self.__downloader.download_one(first)
|
||||
first_song = self.__playlist.next_song()
|
||||
try_another = True
|
||||
|
||||
await self.__play_music(ctx, first_song)
|
||||
while try_another:
|
||||
first = self.__playlist.next_song()
|
||||
if first == None:
|
||||
await self.__send_embed(ctx, description='Houve um problema no download dessa música, tente novamente', colour_name='blue')
|
||||
break
|
||||
|
||||
while True:
|
||||
if first.source != None: # If song got downloaded
|
||||
try_another = False
|
||||
break
|
||||
|
||||
if first.problematic: # If song got any error, try another one
|
||||
break
|
||||
|
||||
else: # The song is downloading, checking another time
|
||||
continue
|
||||
|
||||
if first != None:
|
||||
await self.__play_music(ctx, first)
|
||||
|
||||
@commands.command(name="queue", help="Mostra as atuais músicas da fila.", aliases=['q', 'fila'])
|
||||
async def queue(self, ctx):
|
||||
|
||||
@ -61,12 +61,9 @@ class Playlist(IPlaylist):
|
||||
|
||||
self.__current = self.__queue[0] # Att the current with the first one
|
||||
self.__queue.popleft() # Remove the current from queue
|
||||
if self.__current.source == None: # Try until find one source
|
||||
continue
|
||||
|
||||
else:
|
||||
self.__name_history.append(self.__current.title) # Add to name history
|
||||
self.__name_history.append(self.__current.identifier) # Add to name history
|
||||
self.__songs_history.append(self.__current) # Add to song history
|
||||
|
||||
return self.__current
|
||||
|
||||
def prev_song(self):
|
||||
|
||||
@ -11,6 +11,7 @@ class Song(ISong):
|
||||
"""Create a song with only the URL to the youtube song"""
|
||||
self.__identifier = identifier
|
||||
self.__info = {}
|
||||
self.__problematic = False
|
||||
self.__playlist: IPlaylist = playlist
|
||||
|
||||
def finish_down(self, info: dict) -> None:
|
||||
@ -55,10 +56,14 @@ class Song(ISong):
|
||||
def identifier(self) -> str:
|
||||
return self.__identifier
|
||||
|
||||
@property
|
||||
def problematic(self) -> bool:
|
||||
return self.__problematic
|
||||
|
||||
def destroy(self) -> None:
|
||||
"""Destroy the song from the playlist due to any type of error"""
|
||||
"""Mark this song with problems and removed from the playlist due to any type of error"""
|
||||
self.__problematic = True
|
||||
self.__playlist.destroy_song(self)
|
||||
del self
|
||||
|
||||
def embed(self, title: str) -> Embed:
|
||||
"""Configure the embed to show the song information"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user