1
0
Fork 0
mirror of synced 2024-05-20 12:32:26 +12:00

Move the LiveStreamError to the exceptions module

This commit is contained in:
Phxntxm 2017-04-22 21:45:36 -05:00
parent 543c82a5c4
commit 7e1ca280de
3 changed files with 8 additions and 5 deletions

View file

@ -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:

View file

@ -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

View file

@ -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):