Raptor123471 / DingoLingo

A Discord music bot written in Python with support for Youtube, SoundCloud, Spotify, Bandcamp, Twitter, and custom files.
GNU General Public License v3.0
282 stars 165 forks source link

Crashes and clears queue when no results found for a song #99

Open andreyrd opened 2 years ago

andreyrd commented 2 years ago

When I add a song, via Spotify link, that cannot be found on YouTube, once the song is reached it clears out the entire queue and I get this error:

[download] Downloading playlist: Habakkuk  Georgia Costolo, Tyler Costolo
[youtube:search] query "Habakkuk  Georgia Costolo, Tyler Costolo " page 1: Downloading API JSON
[youtube:search] playlist Habakkuk  Georgia Costolo, Tyler Costolo : Downloading 0 videos
[download] Finished downloading playlist: Habakkuk  Georgia Costolo, Tyler Costolo
Future exception was never retrieved
future: <Future finished exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\andre\applications\DingoLingo\musicbot\audiocontroller.py", line 245, in down
    song.info.webpage_url = self.search_youtube(song.info.title)
  File "C:\Users\andre\applications\DingoLingo\musicbot\audiocontroller.py", line 289, in search_youtube
    videocode = r['entries'][0]['id']
IndexError: list index out of range
[download] Downloading playlist: Sodom's Sins  Georgia Costolo, Tyler Costolo
[youtube:search] query "Sodom's Sins  Georgia Costolo, Tyler Costolo " page 1: Downloading API JSON
[youtube:search] playlist Sodom's Sins  Georgia Costolo, Tyler Costolo : Downloading 0 videos
[download] Finished downloading playlist: Sodom's Sins  Georgia Costolo, Tyler Costolo
Future exception was never retrieved
future: <Future finished exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\andre\applications\DingoLingo\musicbot\audiocontroller.py", line 245, in down
    song.info.webpage_url = self.search_youtube(song.info.title)
  File "C:\Users\andre\applications\DingoLingo\musicbot\audiocontroller.py", line 289, in search_youtube
    videocode = r['entries'][0]['id']
IndexError: list index out of range
Task exception was never retrieved
future: <Task finished name='Task-5465' coro=<AudioController.play_song() done, defined at C:\Users\andre\applications\DingoLingo\musicbot\audiocontroller.py:68> exception=TypeError('expected str, bytes or os.PathLike object, not NoneType')>
Traceback (most recent call last):
  File "C:\Users\andre\applications\DingoLingo\musicbot\audiocontroller.py", line 105, in play_song
    self.guild.voice_client.play(discord.FFmpegPCMAudio(
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\player.py", line 225, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\player.py", line 144, in _spawn_process
    process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1375, in _execute_child
    args = list2cmdline(args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 561, in list2cmdline
    for arg in map(os.fsdecode, seq):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\os.py", line 822, in fsdecode
    filename = fspath(filename)  # Does type-checking of `filename`.
RafaelSolVargas commented 2 years ago

Can you give us an example of an url that presents this problem?

andreyrd commented 2 years ago

https://open.spotify.com/album/1VNWqVr6mUMg177IODYb0T?si=XkXdpLrrTKmLitC0gS868g