More logging improvements.

This commit is contained in:
Matthew Stratford 2021-09-01 23:40:28 +01:00
parent 1de449fe0c
commit d3df33ecf0
3 changed files with 9 additions and 10 deletions

View file

@ -346,7 +346,7 @@ class MyRadioAPI:
self._log("Not tracklisting, {} is not a track.".format(item.name)) self._log("Not tracklisting, {} is not a track.".format(item.name))
return False 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"] source: str = self.config.get()["myradio_api_tracklist_source"]
data = { data = {

View file

@ -166,8 +166,7 @@ class StateManager:
if not allow: if not allow:
# Just some debug logging. # Just some debug logging.
if update_file and (key not in ["playing", "loaded", "initialised"]): if update_file and (key not in ["playing", "loaded", "initialised", "remaining", "pos_true"]):
self._log("Key: {},\nnew:{}\nold:{}, ".format(key, getattr(value, "__dict__", None), getattr(state_to_update[key], "__dict__", None)), DEBUG)
self._log("Not updating state for key '{}' with value '{}' of type '{}'.".format(key, value, type(value)), DEBUG) 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. # We're trying to update the state with the same value.

View file

@ -659,9 +659,9 @@ class Player:
self.logger.log.info("No tracklist to end.") self.logger.log.info("No tracklist to end.")
return 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: 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: if self.tracklist_end_timer:
self.logger.log.error("Failed to potentially end tracklist, timer already busy.") self.logger.log.error("Failed to potentially end tracklist, timer already busy.")
return return
@ -688,15 +688,15 @@ class Player:
if (state["tracklist_mode"] == "fader-live" and not state["live"]): if (state["tracklist_mode"] == "fader-live" and not state["live"]):
self.logger.log.info("Not tracklisting since fader is not live.") self.logger.log.info("Not tracklisting since fader is not live.")
else: 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) tracklist_id = self.api.post_tracklist_start(loaded_item)
if not tracklist_id: 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: 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) self.state.update("tracklist_id", tracklist_id)
else: 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)) loaded_item.name, tracklist_id))
# No matter what we end up doing, we need to kill this timer so future ones can run. # 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): def _tracklist_end(self, tracklist_id):
if 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) self.api.post_tracklist_end(tracklist_id)
else: else:
self.logger.log.error("Tracklist_id to _tracklist_end() missing. Failed to end tracklist.") self.logger.log.error("Tracklist_id to _tracklist_end() missing. Failed to end tracklist.")