Tool black: auto-format Python code

This commit is contained in:
Odd Stråbø 2024-06-10 09:19:47 +00:00
parent e4d8084c25
commit 7763762212
54 changed files with 6545 additions and 4723 deletions

View file

@ -14,16 +14,16 @@ from jellyfin_kodi.helper import LazyLogger
#################################################################################################
LOG = LazyLogger(__name__)
DELAY = int(settings('startupDelay') if settings('SyncInstallRunDone.bool') else 4)
DELAY = int(settings("startupDelay") if settings("SyncInstallRunDone.bool") else 4)
#################################################################################################
class ServiceManager(threading.Thread):
"""Service thread.
To allow to restart and reload modules internally.
"""
''' Service thread.
To allow to restart and reload modules internally.
'''
exception = None
def __init__(self):
@ -44,10 +44,10 @@ class ServiceManager(threading.Thread):
if service is not None:
# TODO: fix this properly as to not match on str()
if 'ExitService' not in str(error):
if "ExitService" not in str(error):
service.shutdown()
if 'RestartService' in str(error):
if "RestartService" in str(error):
service.reload_objects()
self.exception = error
@ -58,7 +58,7 @@ if __name__ == "__main__":
LOG.info("Delay startup by %s seconds.", DELAY)
while True:
if not settings('enableAddon.bool'):
if not settings("enableAddon.bool"):
LOG.warning("Jellyfin for Kodi is not enabled.")
break
@ -68,12 +68,11 @@ if __name__ == "__main__":
session.start()
session.join() # Block until the thread exits.
if 'RestartService' in str(session.exception):
if "RestartService" in str(session.exception):
continue
except Exception as error:
''' Issue initializing the service.
'''
"""Issue initializing the service."""
LOG.exception(error)
break