mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Moved setting addon mode to utils
It was the only useful function left in setup.py since we've removed the rest of them over time
This commit is contained in:
parent
7ee28a0c71
commit
2cef5b727f
4 changed files with 20 additions and 62 deletions
|
@ -17,10 +17,9 @@ import objects
|
||||||
import connect
|
import connect
|
||||||
import client
|
import client
|
||||||
import library
|
import library
|
||||||
import setup
|
|
||||||
import monitor
|
import monitor
|
||||||
from views import Views, verify_kodi_defaults
|
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 helper.utils import JsonDebugPrinter
|
||||||
from jellyfin import Jellyfin
|
from jellyfin import Jellyfin
|
||||||
|
|
||||||
|
@ -133,7 +132,7 @@ class Service(xbmc.Monitor):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.connect.register()
|
self.connect.register()
|
||||||
setup.Setup()
|
set_addon_mode()
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
LOG.exception(error)
|
LOG.exception(error)
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ from .utils import unzip
|
||||||
from .utils import create_id
|
from .utils import create_id
|
||||||
from .utils import convert_to_local as Local
|
from .utils import convert_to_local as Local
|
||||||
from .utils import has_attribute
|
from .utils import has_attribute
|
||||||
|
from .utils import set_addon_mode
|
||||||
|
|
||||||
from .wrapper import progress
|
from .wrapper import progress
|
||||||
from .wrapper import catch
|
from .wrapper import catch
|
||||||
|
|
|
@ -460,6 +460,23 @@ def has_attribute(obj, name):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return False
|
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):
|
class JsonDebugPrinter(object):
|
||||||
|
|
||||||
|
|
|
@ -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)
|
|
Loading…
Reference in a new issue