From 54f117d330608cb8e8b9de02dc90927f1f609d0e Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sun, 11 Mar 2018 13:49:48 +0100 Subject: [PATCH] add some debug logging for audio bureau --- screenless/bureau/audio/audio.py | 3 +++ screenless/bureau/bureau.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/screenless/bureau/audio/audio.py b/screenless/bureau/audio/audio.py index b32446c..64c2a64 100644 --- a/screenless/bureau/audio/audio.py +++ b/screenless/bureau/audio/audio.py @@ -27,7 +27,9 @@ class Audio(Bureau): only supports line-out signals on the default DAC. """ shortcode, _ = data.split(".") + self.log.debug("looking up shortcode " + shortcode) url = self.urldb.get(shortcode) + self.log.debug(" playing url " + url) subprocess.call(["mocp", "-c"]) subprocess.call(["mocp", "-a", url]) @@ -67,6 +69,7 @@ class Audio(Bureau): Prints the currently playing song or stream on the small printer. """ out = subprocess.check_output(["mocp", "-i"]) + self.log.debug("info output:" + out) self.print_small(out) def save_url(self, url): diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 77c2c4f..cba1c08 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -62,6 +62,9 @@ class LogPrinter(logging.Handler): """ LogPrinter prints logs on a receipt printer for screenless debugging. """ + def __init__(self): + logging.Handler.__init__(self) + def emit(self, record): prn = printer.Usb(0x416, 0x5011, in_ep=0x81, out_ep=0x03) msg = self.format(record)