Skip to content

Commit

Permalink
Add extra logging to track end event.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ev-1 committed Mar 28, 2024
1 parent ec23397 commit 0b44c5b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion musicbot/utils/mixplayer/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from lavalink import AudioTrack, DefaultPlayer, Node
from lavalink.events import QueueEndEvent, TrackEndEvent, TrackExceptionEvent, TrackStartEvent, TrackStuckEvent
from lavalink.filters import Equalizer, Timescale
from lavalink.server import EndReason

from .mixqueue import MixQueue

Expand Down Expand Up @@ -209,7 +210,13 @@ def enable_looping(self, looping: bool):
async def handle_event(self, event):
"""Handles the given event as necessary."""
if isinstance(event, (TrackStuckEvent, TrackExceptionEvent)) or \
isinstance(event, TrackEndEvent) and event.reason == 'FINISHED':
(isinstance(event, TrackEndEvent) and event.reason.may_start_next()):
if isinstance(event, (TrackStuckEvent, TrackExceptionEvent)):
self.logger.debug("Event stuck or except: %s" % event)
if isinstance(event, TrackEndEvent) and event.reason.may_start_next():
self.logger.debug("Event end: %s, %s, %s" % (event, event.reason, event.reason.may_start_next()))
if event.track is not None:
self.logger.debug("Event end track: %s, pos: %s" % (event.track, event.track.position))
self.logger.debug("Track ended, clearing votes")
self.skip_voters.clear()
for _, votes in self.voteables.items():
Expand Down

0 comments on commit 0b44c5b

Please sign in to comment.