Handle when live streams are attempted to be downloaded
This commit is contained in:
parent
6be0c4c93d
commit
ccee1dc046
|
@ -355,6 +355,8 @@ class Music:
|
|||
entry = await self.add_entry(song, ctx)
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send("You took too long!")
|
||||
except ExtractionError as e:
|
||||
await ctx.send(str(e))
|
||||
else:
|
||||
if entry is None:
|
||||
await ctx.send("Sorry but I couldn't download/find {}".format(song))
|
||||
|
|
|
@ -5,6 +5,15 @@ import youtube_dl
|
|||
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
class LiveStreamError(Exception):
|
||||
pass
|
||||
|
||||
def match_filter(info_dict):
|
||||
if 'is_live' in info_dict and info_dict['is_live'] == True:
|
||||
raise LiveStreamError("Cannot download livestreams!")
|
||||
return None
|
||||
|
||||
|
||||
ytdl_format_options = {
|
||||
'format': 'bestaudio/best',
|
||||
'extractaudio': True,
|
||||
|
@ -16,6 +25,7 @@ ytdl_format_options = {
|
|||
'ignoreerrors': False,
|
||||
'logtostderr': False,
|
||||
'quiet': True,
|
||||
'match_filter': match_filter,
|
||||
'no_warnings': True,
|
||||
'default_search': 'auto',
|
||||
'source_address': '0.0.0.0'
|
||||
|
|
Loading…
Reference in a new issue