Error when library is empty and AutoDJ is active
Closed this issue · 1 comments
turlando commented
The software does not crash. It just raise an exception and run.
% python3 api.py
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:shouty.connection:Init connection
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
DEBUG:shouty.connection:Open connection
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/tancredi/Projects/airhead/airhead/broadcaster.py", line 47, in run
uuid = self._playlist.pop()
File "/home/tancredi/Projects/airhead/airhead/playlist.py", line 46, in pop
track = random_track(self._library)
File "/home/tancredi/Projects/airhead/airhead/playlist.py", line 15, in random_track
track = random.choice(library.query())
File "/home/tancredi/Projects/airhead/env/lib/python3.6/random.py", line 257, in choice
raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence