From 3bcf3befeca697069ecf8d178c5fa5abb3983052 Mon Sep 17 00:00:00 2001 From: Daniel Voogsgerd Date: Wed, 27 Mar 2019 17:00:12 +0100 Subject: [PATCH] chore(Spotify): Add logging for events --- resources/custom_modules/mediaplayer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/custom_modules/mediaplayer.py b/resources/custom_modules/mediaplayer.py index 3c688659..4d5f5146 100755 --- a/resources/custom_modules/mediaplayer.py +++ b/resources/custom_modules/mediaplayer.py @@ -11,10 +11,12 @@ logger = logging.getLogger(__name__) def on_play(player, status, manager): + logger.info('Received new playback status') on_metadata(player, player.props.metadata, manager) def on_metadata(player, metadata, manager): + logger.info("Received new metadata") track_info = '' if player.props.player_name == 'spotify' and \ @@ -37,11 +39,13 @@ def on_metadata(player, metadata, manager): def on_player_vanished(manager, player): + logger.info("Player has vanished") sys.stdout.write("\n") sys.stdout.flush() def init_player(manager, name): + logger.debug("Initialize player: {player}".format(player=name.name)) player = Playerctl.Player.new_from_name(name) player.connect('playback-status', on_play, manager) player.connect('metadata', on_metadata, manager) @@ -50,6 +54,7 @@ def init_player(manager, name): def signal_handler(sig, frame): + logger.debug('Received signal to stop, exiting') sys.stdout.write("\n") sys.stdout.flush() # loop.quit()