mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-10-09 02:12:04 +00:00
Add functools wraps
This commit is contained in:
parent
8c467be69f
commit
308daec219
1 changed files with 5 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
@ -23,6 +25,7 @@ def progress(message=None):
|
||||||
"""Will start and close the progress dialog."""
|
"""Will start and close the progress dialog."""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
@wraps(func)
|
||||||
def wrapper(self, item=None, *args, **kwargs):
|
def wrapper(self, item=None, *args, **kwargs):
|
||||||
|
|
||||||
dialog = xbmcgui.DialogProgressBG()
|
dialog = xbmcgui.DialogProgressBG()
|
||||||
|
@ -54,6 +57,7 @@ def progress(message=None):
|
||||||
def stop(func):
|
def stop(func):
|
||||||
"""Wrapper to catch exceptions and return using catch"""
|
"""Wrapper to catch exceptions and return using catch"""
|
||||||
|
|
||||||
|
@wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
||||||
if xbmc.Monitor().waitForAbort(0.00001):
|
if xbmc.Monitor().waitForAbort(0.00001):
|
||||||
|
@ -74,6 +78,7 @@ def stop(func):
|
||||||
def jellyfin_item(func):
|
def jellyfin_item(func):
|
||||||
"""Wrapper to retrieve the jellyfin_db item."""
|
"""Wrapper to retrieve the jellyfin_db item."""
|
||||||
|
|
||||||
|
@wraps(func)
|
||||||
def wrapper(self, item, *args, **kwargs):
|
def wrapper(self, item, *args, **kwargs):
|
||||||
e_item = self.jellyfin_db.get_item_by_id(
|
e_item = self.jellyfin_db.get_item_by_id(
|
||||||
item["Id"] if isinstance(item, dict) else item
|
item["Id"] if isinstance(item, dict) else item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue