Catch when videos fail to download
This commit is contained in:
parent
064e182dde
commit
4ebfcf6613
|
@ -56,12 +56,22 @@ class VoiceState:
|
|||
self.current = None
|
||||
|
||||
async def audio_player_task(self):
|
||||
fmt = ""
|
||||
while True:
|
||||
if self.playing or self.songs.peek() is None:
|
||||
if self.playing:
|
||||
await asyncio.sleep(1)
|
||||
continue
|
||||
song = self.songs.peek()
|
||||
if song is None:
|
||||
await asyncio.sleep(1)
|
||||
continue
|
||||
|
||||
self.current = await self.songs.get_next_entry()
|
||||
try:
|
||||
self.current = await self.songs.get_next_entry()
|
||||
await self.current.channel.send("Now playing {}".format())
|
||||
except ExtractionError as e:
|
||||
await song.channel.send("Failed to download {}!\nError: {}".format(self.current.title, e))
|
||||
continue
|
||||
|
||||
source = FFmpegPCMAudio(
|
||||
self.current.filename,
|
||||
|
|
|
@ -92,16 +92,18 @@ class BasePlaylistEntry:
|
|||
|
||||
|
||||
class URLPlaylistEntry(BasePlaylistEntry):
|
||||
def __init__(self, playlist, url, title, requester, duration=0, expected_filename=None, **meta):
|
||||
def __init__(self, playlist, url, title, ctx, thumbnail, duration=0, expected_filename=None, **meta):
|
||||
super().__init__()
|
||||
|
||||
self.playlist = playlist
|
||||
self.url = url
|
||||
self.title = title
|
||||
self.duration = duration
|
||||
self.thumbnail = thumbnail
|
||||
self.expected_filename = expected_filename
|
||||
self.meta = meta
|
||||
self.requester = requester
|
||||
self.requester = ctx.message.author
|
||||
self.channel = ctx.message.channel
|
||||
self.download_folder = self.playlist.downloader.download_folder
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
@ -37,7 +37,7 @@ class Playlist(EventEmitter):
|
|||
else:
|
||||
return 0
|
||||
|
||||
async def add_entry(self, song_url, requester, **meta):
|
||||
async def add_entry(self, song_url, ctx, **meta):
|
||||
"""
|
||||
Validates and adds a song_url to be played. This does not start the download of the song.
|
||||
|
||||
|
@ -97,7 +97,8 @@ class Playlist(EventEmitter):
|
|||
self,
|
||||
song_url,
|
||||
info.get('title', 'Untitled'),
|
||||
requester,
|
||||
ctx,
|
||||
info.get('thumbnail', None),
|
||||
info.get('duration', 0) or 0,
|
||||
self.downloader.ytdl.prepare_filename(info),
|
||||
**meta
|
||||
|
|
Loading…
Reference in a new issue