Fix tracklisting start timer not clearing.

This commit is contained in:
Matthew Stratford 2021-09-01 23:23:50 +01:00
parent be885d87e4
commit 1de449fe0c

View file

@ -665,6 +665,7 @@ class Player:
if self.tracklist_end_timer:
self.logger.log.error("Failed to potentially end tracklist, timer already busy.")
return
self.state.update("tracklist_id", None)
# This threads it, so it won't hang track loading if it fails.
self.tracklist_end_timer = Timer(1, self._tracklist_end, [tracklist_id])
self.tracklist_end_timer.start()
@ -676,11 +677,11 @@ class Player:
loaded_item = state["loaded_item"]
if not loaded_item:
self.logger.log.error("Tried to call _tracklist_start() with no loaded item!")
return
if not self.isPlaying:
elif not self.isPlaying:
self.logger.log.info("Not tracklisting since not playing.")
return
else:
tracklist_id = state["tracklist_id"]
if (not tracklist_id):
@ -698,6 +699,7 @@ class Player:
self.logger.log.info("Not tracklisting item {}, already got tracklistid: {}".format(
loaded_item.name, tracklist_id))
# No matter what we end up doing, we need to kill this timer so future ones can run.
self.tracklist_start_timer = None
def _tracklist_end(self, tracklist_id):