diff --git a/resources/lib/functions.py b/resources/lib/functions.py index dfd79c1..ffba8dd 100644 --- a/resources/lib/functions.py +++ b/resources/lib/functions.py @@ -1079,6 +1079,7 @@ def PLAY(params): play_info["force_transcode"] = forceTranscode play_info["media_source_id"] = media_source_id play_info["use_default"] = use_default + log.info("Sending embycon_play_action : {0}", play_info) send_event_notification("embycon_play_action", play_info) diff --git a/resources/lib/play_utils.py b/resources/lib/play_utils.py index 009c3d3..6d0aff3 100644 --- a/resources/lib/play_utils.py +++ b/resources/lib/play_utils.py @@ -869,6 +869,7 @@ class PlaybackService(xbmc.Monitor): log.debug("PlaybackService:onNotification:{0}", hex_data) decoded_data = binascii.unhexlify(hex_data) play_info = json.loads(decoded_data) + log.info("Received embycon_play_action : {0}", play_info) playFile(play_info, self.monitor) def screensaver_activated(self): diff --git a/resources/lib/simple_logging.py b/resources/lib/simple_logging.py index 8547746..662db2e 100644 --- a/resources/lib/simple_logging.py +++ b/resources/lib/simple_logging.py @@ -6,6 +6,7 @@ import xbmc import xbmcaddon from json_rpc import json_rpc + class SimpleLogging(): name = "" enable_logging = False @@ -24,7 +25,20 @@ class SimpleLogging(): def __str__(self): return "LoggingEnabled: " + str(self.enable_logging) + def info(self, fmt, *args, **kwargs): + log_line = self.name + " (INFO) -> " + self.log_line(fmt, args) + xbmc.log(log_line, level=xbmc.LOGNOTICE) + def error(self, fmt, *args, **kwargs): + log_line = self.name + " (ERROR) -> " + self.log_line(fmt, args) + xbmc.log(log_line, level=xbmc.LOGERROR) + + def debug(self, fmt, *args, **kwargs): + if self.enable_logging: + log_line = self.name + " (DEBUG) -> " + self.log_line(fmt, args) + xbmc.log(log_line, level=xbmc.LOGDEBUG) + + def log_line(self, fmt, *args): new_args = [] # convert any unicode to utf-8 strings for arg in args: @@ -32,17 +46,5 @@ class SimpleLogging(): new_args.append(arg.encode("utf-8")) else: new_args.append(arg) - log_line = self.name + " (ERROR) -> " + fmt.format(*new_args) - xbmc.log(log_line, level=xbmc.LOGDEBUG) - - def debug(self, fmt, *args, **kwargs): - if self.enable_logging: - new_args = [] - # convert any unicode to utf-8 strings - for arg in args: - if isinstance(arg, unicode): - new_args.append(arg.encode("utf-8")) - else: - new_args.append(arg) - log_line = self.name + " (DEBUG) -> " + fmt.format(*new_args) - xbmc.log(log_line, level=xbmc.LOGDEBUG) + log_line = fmt.format(*new_args) + return log_line diff --git a/service.py b/service.py index fb06b1b..c93dc30 100644 --- a/service.py +++ b/service.py @@ -93,7 +93,6 @@ while not xbmc.abortRequested: websocket_client = WebSocketClient() websocket_client.start() - except Exception as error: log.error("Exception in Playback Monitor: {0}", error) log.error("{0}", traceback.format_exc())