vaibkumr / yTermPlayer

Stream youtube playlists as audio on linux terminal
GNU General Public License v3.0
267 stars 22 forks source link

Crash when starting second song from list #11

Closed maciej-gad-benefex closed 5 years ago

maciej-gad-benefex commented 5 years ago

I'm using yTermPlayer on macOS Mojave, Python 3.7.3. I've got this crash when the app was about to play the second item on a list

Traceback (most recent call last):
  File "/usr/local/bin/yterm", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/yTermPlayer/__main__.py", line 28, in main
    loop.run()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 286, in run
    self._run()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 384, in _run
    self.event_loop.run()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 788, in run
    self._loop()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 821, in _loop
    alarm_callback()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 172, in cb
    callback(self, user_data)
  File "/usr/local/lib/python3.7/site-packages/yTermPlayer/ui.py", line 71, in update_name
    temp = self.player_object.get_time_details()
  File "/usr/local/lib/python3.7/site-packages/yTermPlayer/music_api.py", line 249, in get_time_details
    total_seconds = round(self.player.duration)
TypeError: type NoneType doesn't define __round__ method
vaibkumr commented 5 years ago

Due to some reasons, youtube-dl is sometimes not able to fetch some youtubes. This exception was handled in the latest commits, whenever fetching of a video fails, next video is automatically played. I just pushed these changes on pypi. It should no more crash now. Remember, you need to regularly update youtube-dl for the smooth working of this.