mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Nuke catch and silent_catch decorators from orbit
This commit is contained in:
parent
3ec71e89d6
commit
8b1c0bd1e4
3 changed files with 9 additions and 41 deletions
|
@ -25,8 +25,6 @@ from .utils import set_addon_mode
|
||||||
from .utils import get_filesystem_encoding
|
from .utils import get_filesystem_encoding
|
||||||
|
|
||||||
from .wrapper import progress
|
from .wrapper import progress
|
||||||
from .wrapper import catch
|
|
||||||
from .wrapper import silent_catch
|
|
||||||
from .wrapper import stop
|
from .wrapper import stop
|
||||||
from .wrapper import jellyfin_item
|
from .wrapper import jellyfin_item
|
||||||
from .wrapper import library_check
|
from .wrapper import library_check
|
||||||
|
|
|
@ -48,40 +48,6 @@ def progress(message=None):
|
||||||
return decorator
|
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):
|
def stop(func):
|
||||||
|
|
||||||
''' Wrapper to catch exceptions and return using catch
|
''' Wrapper to catch exceptions and return using catch
|
||||||
|
|
|
@ -8,7 +8,7 @@ import os
|
||||||
from kodi_six import xbmc, xbmcvfs
|
from kodi_six import xbmc, xbmcvfs
|
||||||
|
|
||||||
from objects.obj import Objects
|
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 jellyfin import Jellyfin
|
||||||
from helper import LazyLogger
|
from helper import LazyLogger
|
||||||
|
|
||||||
|
@ -27,13 +27,17 @@ class Player(xbmc.Player):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
xbmc.Player.__init__(self)
|
xbmc.Player.__init__(self)
|
||||||
|
|
||||||
@silent_catch()
|
|
||||||
def get_playing_file(self):
|
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):
|
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):
|
def is_playing_file(self, file):
|
||||||
return file in self.played
|
return file in self.played
|
||||||
|
|
Loading…
Reference in a new issue