Merge pull request #256 from TrueTechy/remove_cachingQ_reset

Moved setting addon mode to utils
This commit is contained in:
mcarlton00 2020-03-30 23:26:46 -04:00 committed by GitHub
commit f4dc20cdf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 62 deletions

View File

@ -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,8 @@ class Service(xbmc.Monitor):
try:
self.connect.register()
setup.Setup()
if not settings('SyncInstallRunDone.bool'):
set_addon_mode()
except Exception as error:
LOG.exception(error)

View File

@ -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

View File

@ -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):

View File

@ -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)