From 7bffbc98b5d564e130517113a3c362897010a8cd Mon Sep 17 00:00:00 2001 From: TrueTechy Date: Wed, 2 Oct 2019 01:59:25 +0100 Subject: [PATCH] Make log levels more appropriate and change warn to warnings --- resources/lib/database/__init__.py | 6 ++-- resources/lib/downloader.py | 2 +- resources/lib/entrypoint/default.py | 2 +- resources/lib/entrypoint/service.py | 32 +++++++++---------- resources/lib/helper/xmls.py | 2 +- .../lib/jellyfin/core/connection_manager.py | 2 +- resources/lib/jellyfin/core/credentials.py | 2 +- resources/lib/jellyfin/core/http.py | 4 +-- resources/lib/library.py | 6 ++-- resources/lib/monitor.py | 4 +-- resources/lib/player.py | 2 +- service.py | 8 ++--- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/resources/lib/database/__init__.py b/resources/lib/database/__init__.py index 69367b72..24c56464 100644 --- a/resources/lib/database/__init__.py +++ b/resources/lib/database/__init__.py @@ -279,7 +279,7 @@ def reset_kodi(): if name != 'version': musicdb.cursor.execute("DELETE FROM " + name) - LOG.warn("[ reset kodi ]") + LOG.info("[ reset kodi ]") def reset_jellyfin(): @@ -296,7 +296,7 @@ def reset_jellyfin(): jellyfindb.cursor.execute("DROP table IF EXISTS view") jellyfindb.cursor.execute("DROP table IF EXISTS version") - LOG.warn("[ reset jellyfin ]") + LOG.info("[ reset jellyfin ]") def reset_artwork(): @@ -323,7 +323,7 @@ def reset_artwork(): if name != 'version': texdb.cursor.execute("DELETE FROM " + name) - LOG.warn("[ reset artwork ]") + LOG.info("[ reset artwork ]") def get_sync(): diff --git a/resources/lib/downloader.py b/resources/lib/downloader.py index 0561165a..89fe6a47 100644 --- a/resources/lib/downloader.py +++ b/resources/lib/downloader.py @@ -26,7 +26,7 @@ def get_jellyfinserver_url(handler): if handler.startswith('/'): handler = handler[1:] - LOG.warn("handler starts with /: %s", handler) + LOG.info("handler starts with /: %s", handler) return "{server}/emby/%s" % handler diff --git a/resources/lib/entrypoint/default.py b/resources/lib/entrypoint/default.py index 339c160a..16a53618 100644 --- a/resources/lib/entrypoint/default.py +++ b/resources/lib/entrypoint/default.py @@ -51,7 +51,7 @@ class Events(object): if server == 'None': server = None - LOG.warn("path: %s params: %s", path, json.dumps(params, indent=4)) + LOG.info("path: %s params: %s", path, json.dumps(params, indent=4)) if '/extrafanart' in base_url: diff --git a/resources/lib/entrypoint/service.py b/resources/lib/entrypoint/service.py index d2aa5dd1..7dab8260 100644 --- a/resources/lib/entrypoint/service.py +++ b/resources/lib/entrypoint/service.py @@ -60,13 +60,13 @@ class Service(xbmc.Monitor): if self.settings['enable_context_transcode']: window('jellyfin_context_transcode.bool', True) - LOG.warn("--->>>[ %s ]", client.get_addon_name()) - LOG.warn("Version: %s", client.get_version()) - LOG.warn("KODI Version: %s", xbmc.getInfoLabel('System.BuildVersion')) - LOG.warn("Platform: %s", settings('platformDetected')) - LOG.warn("Python Version: %s", sys.version) - LOG.warn("Using dynamic paths: %s", settings('useDirectPaths') == "0") - LOG.warn("Log Level: %s", self.settings['log_level']) + LOG.info("--->>>[ %s ]", client.get_addon_name()) + LOG.info("Version: %s", client.get_version()) + LOG.info("KODI Version: %s", xbmc.getInfoLabel('System.BuildVersion')) + LOG.info("Platform: %s", settings('platformDetected')) + LOG.info("Python Version: %s", sys.version) + LOG.info("Using dynamic paths: %s", settings('useDirectPaths') == "0") + LOG.info("Log Level: %s", self.settings['log_level']) self.check_version() verify_kodi_defaults() @@ -161,7 +161,7 @@ class Service(xbmc.Monitor): if not resp: - LOG.warn("Database version is out of date! USER IGNORED!") + LOG.warning("Database version is out of date! USER IGNORED!") dialog("ok", heading=_('addon_name'), line1=_(33023)) raise Exception("User backed out of a required database reset") @@ -347,7 +347,7 @@ class Service(xbmc.Monitor): elif method == 'System.OnWake': if not self.monitor.sleep: - LOG.warn("System.OnSleep was never called, skip System.OnWake") + LOG.warning("System.OnSleep was never called, skip System.OnWake") return @@ -386,24 +386,24 @@ class Service(xbmc.Monitor): log_level = settings('logLevel') window('jellyfin_logLevel', str(log_level)) self.settings['logLevel'] = log_level - LOG.warn("New log level: %s", log_level) + LOG.info("New log level: %s", log_level) if settings('enableContext.bool') != self.settings['enable_context']: window('jellyfin_context', settings('enableContext')) self.settings['enable_context'] = settings('enableContext.bool') - LOG.warn("New context setting: %s", self.settings['enable_context']) + LOG.info("New context setting: %s", self.settings['enable_context']) if settings('enableContextTranscode.bool') != self.settings['enable_context_transcode']: window('jellyfin_context_transcode', settings('enableContextTranscode')) self.settings['enable_context_transcode'] = settings('enableContextTranscode.bool') - LOG.warn("New context transcode setting: %s", self.settings['enable_context_transcode']) + LOG.info("New context transcode setting: %s", self.settings['enable_context_transcode']) if settings('useDirectPaths') != self.settings['mode'] and self.library_thread.started: self.settings['mode'] = settings('useDirectPaths') - LOG.warn("New playback mode setting: %s", self.settings['mode']) + LOG.info("New playback mode setting: %s", self.settings['mode']) if not self.settings.get('mode_warn'): @@ -437,11 +437,11 @@ class Service(xbmc.Monitor): objects.obj.Objects().mapping() - LOG.warn("---[ objects reloaded ]") + LOG.info("---[ objects reloaded ]") def shutdown(self): - LOG.warn("---<[ EXITING ]") + LOG.info("---<[ EXITING ]") window('jellyfin_should_stop.bool', True) properties = [ # TODO: review @@ -464,4 +464,4 @@ class Service(xbmc.Monitor): self.monitor.listener.stop() self.monitor.webservice.stop() - LOG.warn("---<<<[ %s ]", client.get_addon_name()) + LOG.info("---<<<[ %s ]", client.get_addon_name()) diff --git a/resources/lib/helper/xmls.py b/resources/lib/helper/xmls.py index 071233b3..13215de2 100644 --- a/resources/lib/helper/xmls.py +++ b/resources/lib/helper/xmls.py @@ -119,7 +119,7 @@ def advanced_settings(): if cleanonupdate is not None and cleanonupdate.text == "true": - LOG.warn("cleanonupdate disabled") + LOG.warning("cleanonupdate disabled") video.remove(cleanonupdate) indent(xml) diff --git a/resources/lib/jellyfin/core/connection_manager.py b/resources/lib/jellyfin/core/connection_manager.py index 410f9f80..7496413c 100644 --- a/resources/lib/jellyfin/core/connection_manager.py +++ b/resources/lib/jellyfin/core/connection_manager.py @@ -327,7 +327,7 @@ class ConnectionManager(object): return self._test_next_connection_mode(tests, index + 1, server, options) else: if self._compare_versions(self._get_min_server_version(), result['Version']) == 1: - LOG.warn("minServerVersion requirement not met. Server version: %s", result['Version']) + LOG.warning("minServerVersion requirement not met. Server version: %s", result['Version']) return { 'State': CONNECTION_STATE['ServerUpdateNeeded'], 'Servers': [server] diff --git a/resources/lib/jellyfin/core/credentials.py b/resources/lib/jellyfin/core/credentials.py index 56e2f6e3..ccd6a33d 100644 --- a/resources/lib/jellyfin/core/credentials.py +++ b/resources/lib/jellyfin/core/credentials.py @@ -40,7 +40,7 @@ class Credentials(object): raise ValueError("invalid credentials format") except Exception as e: # File is either empty or missing - LOG.warn(e) + LOG.warning(e) self.credentials = {} LOG.debug("credentials initialized with: %s", self.credentials) diff --git a/resources/lib/jellyfin/core/http.py b/resources/lib/jellyfin/core/http.py index 24dc7877..ba4ebeb0 100644 --- a/resources/lib/jellyfin/core/http.py +++ b/resources/lib/jellyfin/core/http.py @@ -40,10 +40,10 @@ class HTTP(object): return try: - LOG.warn("--<[ session/%s ]", id(self.session)) + LOG.info("--<[ session/%s ]", id(self.session)) self.session.close() except Exception as error: - LOG.warn("The requests session could not be terminated: %s", error) + LOG.warning("The requests session could not be terminated: %s", error) def _replace_user_info(self, string): diff --git a/resources/lib/library.py b/resources/lib/library.py index bfeb26bc..6f9854ec 100644 --- a/resources/lib/library.py +++ b/resources/lib/library.py @@ -96,7 +96,7 @@ class Library(threading.Thread): def run(self): - LOG.warn("--->[ library ]") + LOG.info("--->[ library ]") if not self.startup(): self.stop_client() @@ -117,7 +117,7 @@ class Library(threading.Thread): if self.monitor.waitForAbort(2): break - LOG.warn("---<[ library ]") + LOG.info("---<[ library ]") def test_databases(self): @@ -420,7 +420,7 @@ class Library(threading.Thread): ''' Inverse yes no, in case the dialog is forced closed by Kodi. ''' if dialog("yesno", heading="{jellyfin}", line1=_(33172).replace('{number}', str(total)), nolabel=_(107), yeslabel=_(106)): - LOG.warn("Large updates skipped.") + LOG.warning("Large updates skipped.") return True diff --git a/resources/lib/monitor.py b/resources/lib/monitor.py index a6194cd1..bacca814 100644 --- a/resources/lib/monitor.py +++ b/resources/lib/monitor.py @@ -448,7 +448,7 @@ class Listener(threading.Thread): ''' Detect the resume dialog for widgets. Detect external players. ''' - LOG.warn("--->[ listener ]") + LOG.info("--->[ listener ]") while not self.stop_thread: special_listener() @@ -457,7 +457,7 @@ class Listener(threading.Thread): # Abort was requested while waiting. We should exit break - LOG.warn("---<[ listener ]") + LOG.info("---<[ listener ]") def stop(self): self.stop_thread = True diff --git a/resources/lib/player.py b/resources/lib/player.py index c2b4b9c1..a6204be4 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -247,7 +247,7 @@ class Player(xbmc.Player): try: next_item = next_items['Items'][index + 1] except IndexError: - LOG.warn("No next up episode.") + LOG.warning("No next up episode.") return diff --git a/service.py b/service.py index 697807ae..3fb52989 100644 --- a/service.py +++ b/service.py @@ -68,13 +68,13 @@ class ServiceManager(threading.Thread): if __name__ == "__main__": - LOG.warn("-->[ service ]") - LOG.warn("Delay startup by %s seconds.", DELAY) + LOG.info("-->[ service ]") + LOG.info("Delay startup by %s seconds.", DELAY) while True: if not settings('enableAddon.bool'): - LOG.warn("Jellyfin for Kodi is not enabled.") + LOG.warning("Jellyfin for Kodi is not enabled.") break @@ -93,4 +93,4 @@ if __name__ == "__main__": break - LOG.warn("--<[ service ]") + LOG.info("--<[ service ]")