From d3df33ecf01ec83dcb61ae00513d1836ec681713 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Wed, 1 Sep 2021 23:40:28 +0100 Subject: [PATCH] More logging improvements. --- helpers/myradio_api.py | 2 +- helpers/state_manager.py | 3 +-- player.py | 14 +++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/helpers/myradio_api.py b/helpers/myradio_api.py index 7f3703c..d73cacf 100644 --- a/helpers/myradio_api.py +++ b/helpers/myradio_api.py @@ -346,7 +346,7 @@ class MyRadioAPI: self._log("Not tracklisting, {} is not a track.".format(item.name)) return False - self._log("Tracklisting item: {}".format(item.name)) + self._log("Tracklisting item: '{}'".format(item.name)) source: str = self.config.get()["myradio_api_tracklist_source"] data = { diff --git a/helpers/state_manager.py b/helpers/state_manager.py index 6e9dee9..fb45cb2 100644 --- a/helpers/state_manager.py +++ b/helpers/state_manager.py @@ -166,8 +166,7 @@ class StateManager: if not allow: # Just some debug logging. - if update_file and (key not in ["playing", "loaded", "initialised"]): - self._log("Key: {},\nnew:{}\nold:{}, ".format(key, getattr(value, "__dict__", None), getattr(state_to_update[key], "__dict__", None)), DEBUG) + if update_file and (key not in ["playing", "loaded", "initialised", "remaining", "pos_true"]): self._log("Not updating state for key '{}' with value '{}' of type '{}'.".format(key, value, type(value)), DEBUG) # We're trying to update the state with the same value. diff --git a/player.py b/player.py index a349beb..c7eefc3 100644 --- a/player.py +++ b/player.py @@ -659,9 +659,9 @@ class Player: self.logger.log.info("No tracklist to end.") return - self.logger.log.info("Setting timer for ending tracklist_id {}".format(tracklist_id)) + self.logger.log.info("Setting timer for ending tracklist_id '{}'".format(tracklist_id)) if tracklist_id: - self.logger.log.info("Attempting to end tracklist_id {}".format(tracklist_id)) + self.logger.log.info("Attempting to end tracklist_id '{}'".format(tracklist_id)) if self.tracklist_end_timer: self.logger.log.error("Failed to potentially end tracklist, timer already busy.") return @@ -688,15 +688,15 @@ class Player: if (state["tracklist_mode"] == "fader-live" and not state["live"]): self.logger.log.info("Not tracklisting since fader is not live.") else: - self.logger.log.info("Tracklisting item: {}".format(loaded_item.name)) + self.logger.log.info("Tracklisting item: '{}'".format(loaded_item.name)) tracklist_id = self.api.post_tracklist_start(loaded_item) if not tracklist_id: - self.logger.log.warning("Failed to tracklist {}".format(loaded_item.name)) + self.logger.log.warning("Failed to tracklist '{}'".format(loaded_item.name)) else: - self.logger.log.info("Tracklist id: {}".format(tracklist_id)) + self.logger.log.info("Tracklist id: '{}'".format(tracklist_id)) self.state.update("tracklist_id", tracklist_id) else: - self.logger.log.info("Not tracklisting item {}, already got tracklistid: {}".format( + 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. @@ -705,7 +705,7 @@ class Player: def _tracklist_end(self, tracklist_id): if tracklist_id: - self.logger.log.info("Attempting to end tracklist_id {}".format(tracklist_id)) + self.logger.log.info("Attempting to end tracklist_id '{}'".format(tracklist_id)) self.api.post_tracklist_end(tracklist_id) else: self.logger.log.error("Tracklist_id to _tracklist_end() missing. Failed to end tracklist.")