From 8b1c0bd1e49eed07a89f10a5c23bfeb1c6a82fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sat, 1 Aug 2020 00:03:40 +0200 Subject: [PATCH] Nuke catch and silent_catch decorators from orbit --- jellyfin_kodi/helper/__init__.py | 2 -- jellyfin_kodi/helper/wrapper.py | 34 -------------------------------- jellyfin_kodi/player.py | 14 ++++++++----- 3 files changed, 9 insertions(+), 41 deletions(-) diff --git a/jellyfin_kodi/helper/__init__.py b/jellyfin_kodi/helper/__init__.py index bae482a9..e4a65c98 100644 --- a/jellyfin_kodi/helper/__init__.py +++ b/jellyfin_kodi/helper/__init__.py @@ -25,8 +25,6 @@ from .utils import set_addon_mode from .utils import get_filesystem_encoding from .wrapper import progress -from .wrapper import catch -from .wrapper import silent_catch from .wrapper import stop from .wrapper import jellyfin_item from .wrapper import library_check diff --git a/jellyfin_kodi/helper/wrapper.py b/jellyfin_kodi/helper/wrapper.py index d7c38004..80693a12 100644 --- a/jellyfin_kodi/helper/wrapper.py +++ b/jellyfin_kodi/helper/wrapper.py @@ -48,40 +48,6 @@ def progress(message=None): return decorator -def catch(errors=(Exception,)): - - ''' Wrapper to catch exceptions and return using catch - ''' - def decorator(func): - def wrapper(*args, **kwargs): - - try: - return func(*args, **kwargs) - except errors as error: - LOG.exception(error) - - raise Exception("Caught exception") - - return wrapper - return decorator - - -def silent_catch(errors=(Exception,)): - - ''' Wrapper to catch exceptions and ignore them - ''' - def decorator(func): - def wrapper(*args, **kwargs): - - try: - return func(*args, **kwargs) - except errors as error: - LOG.error(error) - - return wrapper - return decorator - - def stop(func): ''' Wrapper to catch exceptions and return using catch diff --git a/jellyfin_kodi/player.py b/jellyfin_kodi/player.py index 8eefaf69..0772b57c 100644 --- a/jellyfin_kodi/player.py +++ b/jellyfin_kodi/player.py @@ -8,7 +8,7 @@ import os from kodi_six import xbmc, xbmcvfs from objects.obj import Objects -from helper import translate, api, window, settings, dialog, event, silent_catch, JSONRPC +from helper import translate, api, window, settings, dialog, event, JSONRPC from jellyfin import Jellyfin from helper import LazyLogger @@ -27,13 +27,17 @@ class Player(xbmc.Player): def __init__(self): xbmc.Player.__init__(self) - @silent_catch() def get_playing_file(self): - return self.getPlayingFile() + try: + return self.getPlayingFile() + except Exception as error: + LOG.exception(error) - @silent_catch() def get_file_info(self, file): - return self.played[file] + try: + return self.played[file] + except Exception as error: + LOG.exception(error) def is_playing_file(self, file): return file in self.played