Skip to content

Commit

Permalink
[Bugfix] Ignore extraction error from ytdl that is preventing bot fro…
Browse files Browse the repository at this point in the history
…m playing playlist with some bad entries (Just-Some-Bots#1860)

* Ignore error from ytdl when resolving entry type

Postpone error in this stage to prevent bot from not playing the playlist completely

* comment for future reference

* dunno why it fail because Just-Some-Bots#1879
  • Loading branch information
TheerapakG authored and Jayden Bailey committed Aug 25, 2019
1 parent af87d5e commit 79a3710
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions musicbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
from .constants import VERSION as BOTVERSION
from .constants import DISCORD_MSG_CHAR_LIMIT, AUDIO_CACHE_PATH


load_opus_lib()

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -1396,8 +1395,15 @@ async def cmd_play(self, message, player, channel, author, permissions, leftover
while True:
try:
info = await self.downloader.extract_info(player.playlist.loop, song_url, download=False, process=False)
info_process = await self.downloader.extract_info(player.playlist.loop, song_url, download=False)
# If there is an exception arise when processing we go on and let extract_info down the line report it
# because info might be a playlist and thing that's broke it might be individual entry
try:
info_process = await self.downloader.extract_info(player.playlist.loop, song_url, download=False)
except:
info_process = None

log.debug(info)

if info_process and info and info_process.get('_type', None) == 'playlist' and 'entries' not in info and not info.get('url', '').startswith('ytsearch'):
use_url = info_process.get('webpage_url', None) or info_process.get('url', None)
if use_url == song_url:
Expand Down

0 comments on commit 79a3710

Please sign in to comment.