diff --git a/jellyfin_kodi/entrypoint/service.py b/jellyfin_kodi/entrypoint/service.py index 27ee4372..5c1c3a8f 100644 --- a/jellyfin_kodi/entrypoint/service.py +++ b/jellyfin_kodi/entrypoint/service.py @@ -17,10 +17,9 @@ import objects import connect import client import library -import setup import monitor from views import Views, verify_kodi_defaults -from helper import translate, window, settings, event, dialog +from helper import translate, window, settings, event, dialog, set_addon_mode from helper.utils import JsonDebugPrinter from jellyfin import Jellyfin @@ -133,7 +132,7 @@ class Service(xbmc.Monitor): try: self.connect.register() - setup.Setup() + set_addon_mode() except Exception as error: LOG.exception(error) diff --git a/jellyfin_kodi/helper/__init__.py b/jellyfin_kodi/helper/__init__.py index e0496067..0d51b89e 100644 --- a/jellyfin_kodi/helper/__init__.py +++ b/jellyfin_kodi/helper/__init__.py @@ -18,6 +18,7 @@ from .utils import unzip from .utils import create_id from .utils import convert_to_local as Local from .utils import has_attribute +from .utils import set_addon_mode from .wrapper import progress from .wrapper import catch diff --git a/jellyfin_kodi/helper/utils.py b/jellyfin_kodi/helper/utils.py index 9380f589..c62f0127 100644 --- a/jellyfin_kodi/helper/utils.py +++ b/jellyfin_kodi/helper/utils.py @@ -460,6 +460,23 @@ def has_attribute(obj, name): except AttributeError: return False +def set_addon_mode(): + + ''' Setup playback mode. If native mode selected, check network credentials. + ''' + value = dialog("yesno", + heading=translate('playback_mode'), + line1=translate(33035), + nolabel=translate('addon_mode'), + yeslabel=translate('native_mode')) + + settings('useDirectPaths', value="1" if value else "0") + + if value: + dialog("ok", heading="{jellyfin}", line1=translate(33145)) + + LOG.info("Add-on playback: %s", settings('useDirectPaths') == "0") + class JsonDebugPrinter(object): diff --git a/jellyfin_kodi/setup.py b/jellyfin_kodi/setup.py deleted file mode 100644 index 6381fce1..00000000 --- a/jellyfin_kodi/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import division, absolute_import, print_function, unicode_literals - -################################################################################################# - -import logging - -from helper import translate, settings, dialog, JSONRPC - -################################################################################################# - -LOG = logging.getLogger("JELLYFIN." + __name__) - -################################################################################################# - - -class Setup(object): - - def __init__(self): - - self.setup() - - LOG.info("---<[ setup ]") - - def setup(self): - - minimum = "3.0.24" - cached = settings('MinimumSetup') - - if cached == minimum: - return - - if not cached: - - self._is_mode() - LOG.info("Add-on playback: %s", settings('useDirectPaths') == "0") - - # Setup completed - settings('MinimumSetup', minimum) - - def _is_mode(self): - - ''' Setup playback mode. If native mode selected, check network credentials. - ''' - value = dialog("yesno", - heading=translate('playback_mode'), - line1=translate(33035), - nolabel=translate('addon_mode'), - yeslabel=translate('native_mode')) - - settings('useDirectPaths', value="1" if value else "0") - - if value: - dialog("ok", heading="{jellyfin}", line1=translate(33145)) - - def _is_music(self): - - value = dialog("yesno", heading="{jellyfin}", line1=translate(33039)) - settings('enableMusic.bool', value=value)