Playing the next episode after watching an anime crashes Anipy-cli
Closed this issue · 3 comments
Describe the bug
When I attempt to watch the next episode of an anime after streaming it, Ani-Py crashes.
To Reproduce
Steps to reproduce the behavior:
- Watch an anime of your choosing using anipy
- After the episode finishes, press
n
for the next episode - See error
Expected behavior
When pressing n
, the next episode should play
Info
Post your output of pip show anipy-cli
Name: anipy-cli
Version: 3.1.11
Summary: Watch and Download anime from the comfort of your Terminal
Home-page: https://sdaqo.github.io/anipy-cli
Author: sdaqo
Author-email: sdaqo.dev@protonmail.com
License: GPL-3.0
Location: C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages
Editable project location: X:\Assets\Code\GitHubIssues\anipy-cli\cli
Requires: anipy-api, appdirs, inquirerpy, pypresence, pyyaml, yaspin
Required-by:
Platform
- OS: Windows
Additional context
I use the Gogo provider, and I use VLC as the player. So far it seems like the session is no longer valid, so maybe if this occurs, we need to recreate the session.
Error
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Scripts\anipy-cli.exe\__main__.py", line 7, in <module>
File "X:\Assets\Code\GitHubIssues\anipy-cli\cli\src\anipy_cli\cli.py", line 60, in run_cli
cli_class(options=args).run()
File "X:\Assets\Code\GitHubIssues\anipy-cli\cli\src\anipy_cli\clis\base_cli.py", line 31, in run
ret = func()
^^^^^^
File "X:\Assets\Code\GitHubIssues\anipy-cli\cli\src\anipy_cli\clis\default_cli.py", line 113, in post
).run()
^^^^^
File "X:\Assets\Code\GitHubIssues\anipy-cli\cli\src\anipy_cli\menus\base_menu.py", line 30, in run
self.take_input()
File "X:\Assets\Code\GitHubIssues\anipy-cli\cli\src\anipy_cli\menus\base_menu.py", line 41, in take_input
op.callback()
File "X:\Assets\Code\GitHubIssues\anipy-cli\cli\src\anipy_cli\menus\menu.py", line 93, in next_ep
episodes = self.anime.get_episodes(self.lang)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages\anipy_api\anime.py", line 84, in get_episodes
return self.provider.get_episodes(self.identifier, lang)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages\anipy_api\provider\providers\gogo_provider.py", line 180, in get_episodes
ep_list = self._get_episode_ajax(identifier, lang)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages\anipy_api\provider\providers\gogo_provider.py", line 357, in _get_episode_ajax
res = request_page(self.session, req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages\anipy_api\provider\utils.py", line 24, in request_page
res = session.send(prepped)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Logan\AppData\Local\pypoetry\Cache\virtualenvs\non-package-mode-zbK-QQCB-py3.12\Lib\site-packages\requests\adapters.py", line 682, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
I am a contributor for this project, so naturally I'll be looking into this, and attempting to write a fix myself. However, with something like this I would prefer to document the event to see if there's anything more we could be missing or what we could do
I have test Yugen and Gogo and it happens on both. It looks like the easiest way to solve this is to create a new session when a Connection Error occurs. I'll start working on a solution.
fixed in 3.2.1