Move the LiveStreamError to the exceptions module
This commit is contained in:
parent
543c82a5c4
commit
7e1ca280de
|
@ -245,6 +245,8 @@ class Music:
|
|||
return None
|
||||
entry, _ = await state.songs.add_entry(song, requester)
|
||||
|
||||
if entry.get('is_live', False):
|
||||
raise LiveStreamError("I cannot download a live stream!!")
|
||||
return entry
|
||||
|
||||
@commands.command(pass_context=True)
|
||||
|
@ -355,7 +357,7 @@ class Music:
|
|||
entry = await self.add_entry(song, ctx)
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send("You took too long!")
|
||||
except ExtractionError as e:
|
||||
except LiveStreamError as e:
|
||||
await ctx.send(str(e))
|
||||
else:
|
||||
if entry is None:
|
||||
|
|
|
@ -5,12 +5,9 @@ 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 "Cannot download live streams!"
|
||||
return None
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ class CommandError(MusicbotException):
|
|||
class ExtractionError(MusicbotException):
|
||||
pass
|
||||
|
||||
# Live stream's cannot be downloaded
|
||||
class LiveStreamError(MusicbotException):
|
||||
pass
|
||||
|
||||
|
||||
# The no processing entry type failed and an entry was a playlist/vice versa
|
||||
class WrongEntryTypeError(ExtractionError):
|
||||
|
|
Loading…
Reference in a new issue