From 5f571567a3cc0814d6a1ad5841e5893b67b57184 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Tue, 11 Jul 2017 12:59:24 -0500 Subject: [PATCH] Handle if something that's not a playlist is given --- cogs/voice_utilities/playlist.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cogs/voice_utilities/playlist.py b/cogs/voice_utilities/playlist.py index e839700..f35d9eb 100644 --- a/cogs/voice_utilities/playlist.py +++ b/cogs/voice_utilities/playlist.py @@ -51,11 +51,7 @@ class Playlist(EventEmitter): Imports the songs from `playlist_url` and queues them to be played. Returns a list of `entries` that have been enqueued. - - :param playlist_url: The playlist url to be cut into individual urls and added to the playlist """ - position = len(self.entries) + 1 - entry_list = [] try: info = await self.downloader.safe_extract_info(self.loop, playlist_url, download=False) @@ -65,6 +61,9 @@ class Playlist(EventEmitter): if not info: raise ExtractionError('Could not extract information from %s' % playlist_url) + if info.get('playlist') is None: + raise WrongEntryTypeError('This is not a playlist!') + # Once again, the generic extractor fucks things up. if info.get('extractor', None) == 'generic': url_field = 'url'