Merge pull request #578 from oddstr13/cleanup/path-hack

Clean up sys.path manipulation in favor of proper imports
This commit is contained in:
Odd Stråbø 2021-10-12 18:16:38 +02:00 committed by GitHub
commit 2a8b06a911
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 185 additions and 290 deletions

1
.env
View file

@ -1 +0,0 @@
PYTHONPATH=jellyfin_kodi

1
.gitignore vendored
View file

@ -50,6 +50,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.mypy_cache/
flake8.output
test.xml

View file

@ -3,26 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import os
import sys
from kodi_six import xbmc, xbmcaddon, xbmcvfs
#################################################################################################
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
__addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin')
if kodi_version > 18:
__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
else:
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
sys.path.insert(0, __base__)
#################################################################################################
from entrypoint import Context # noqa: E402
from helper import LazyLogger # noqa: E402
from jellyfin_kodi.entrypoint import Context
from jellyfin_kodi.helper import LazyLogger
#################################################################################################

View file

@ -3,26 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import os
import sys
from kodi_six import xbmc, xbmcaddon, xbmcvfs
#################################################################################################
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
__addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin')
if kodi_version > 18:
__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
else:
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
sys.path.insert(0, __base__)
#################################################################################################
from entrypoint import Context # noqa: E402
from helper import LazyLogger # noqa: E402
from jellyfin_kodi.entrypoint import Context
from jellyfin_kodi.helper import LazyLogger
#################################################################################################

View file

@ -3,26 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import os
import sys
from kodi_six import xbmc, xbmcaddon, xbmcvfs
#################################################################################################
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
__addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin')
if kodi_version > 18:
__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
else:
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
sys.path.insert(0, __base__)
#################################################################################################
from entrypoint import Events # noqa: E402
from helper import LazyLogger # noqa: E402
from jellyfin_kodi.entrypoint import Events
from jellyfin_kodi.helper import LazyLogger
#################################################################################################

View file

@ -7,9 +7,8 @@ import os
from kodi_six import xbmc, xbmcaddon, xbmcvfs
from helper import translate, window, settings, addon_id, dialog
from helper.utils import create_id, translate_path
from helper import LazyLogger # noqa: F402
from .helper import translate, window, settings, addon_id, dialog, LazyLogger
from .helper.utils import create_id, translate_path
##################################################################################################

View file

@ -5,14 +5,13 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from kodi_six import xbmc, xbmcaddon
import client
from database import get_credentials, save_credentials
from dialogs import ServerConnect, UsersConnect, LoginManual, ServerManual
from helper import settings, addon_id, event, api, window
from jellyfin import Jellyfin
from jellyfin.connection_manager import CONNECTION_STATE
from helper.exceptions import HTTPException
from helper import LazyLogger
from . import client
from .database import get_credentials, save_credentials
from .dialogs import ServerConnect, UsersConnect, LoginManual, ServerManual
from .helper import settings, addon_id, event, api, window, LazyLogger
from .jellyfin import Jellyfin
from .jellyfin.connection_manager import CONNECTION_STATE
from .helper.exceptions import HTTPException
##################################################################################################

View file

@ -12,11 +12,11 @@ import re
from kodi_six import xbmc, xbmcvfs
from six import text_type
from database import jellyfin_db
from helper import translate, settings, window, dialog
from helper.utils import translate_path
from objects import obj
from helper import LazyLogger
from . import jellyfin_db
from ..helper import translate, settings, window, dialog
from ..helper.utils import translate_path
from ..objects import obj
from ..helper import LazyLogger
#################################################################################################
@ -200,7 +200,7 @@ def reset():
''' Reset both the jellyfin database and the kodi database.
'''
from views import Views
from ..views import Views
views = Views()
if not dialog("yesno", "{jellyfin}", translate(33074)):

View file

@ -2,10 +2,10 @@
from __future__ import division, absolute_import, print_function, unicode_literals
#################################################################################################
from database import queries as QU
from helper import LazyLogger
from . import queries as QU
from ..helper import LazyLogger
from jellyfin.utils import sqlite_namedtuple_factory
from ..jellyfin.utils import sqlite_namedtuple_factory
##################################################################################################

View file

@ -8,8 +8,8 @@ import os
from kodi_six import xbmcgui, xbmcaddon
from six import ensure_text
from helper import window, addon_id
from helper import LazyLogger
from ..helper import window, addon_id
from ..helper import LazyLogger
##################################################################################################

View file

@ -6,9 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from six import iteritems
from kodi_six import xbmcgui
from helper import translate
from helper import LazyLogger
from helper import kodi_version
from ..helper import translate, LazyLogger, kodi_version
##################################################################################################

View file

@ -5,7 +5,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from kodi_six import xbmc, xbmcgui
from helper import LazyLogger
from ..helper import LazyLogger
##################################################################################################

View file

@ -6,9 +6,9 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from six import iteritems
from kodi_six import xbmc, xbmcgui
from helper import translate
from jellyfin.connection_manager import CONNECTION_STATE
from helper import LazyLogger
from ..helper import translate
from ..jellyfin.connection_manager import CONNECTION_STATE
from ..helper import LazyLogger
##################################################################################################

View file

@ -8,9 +8,9 @@ import re
from six import iteritems
from kodi_six import xbmcgui
from helper import translate
from jellyfin.connection_manager import CONNECTION_STATE
from helper import LazyLogger
from ..helper import translate
from ..jellyfin.connection_manager import CONNECTION_STATE
from ..helper import LazyLogger
##################################################################################################

View file

@ -4,9 +4,10 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from six import iteritems
from kodi_six import xbmc, xbmcgui
from kodi_six import xbmcgui
from helper import LazyLogger
from ..helper import LazyLogger
from ..helper.utils import kodi_version
##################################################################################################
@ -30,7 +31,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
self.kodi_version = kodi_version()
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
def set_args(self, **kwargs):

View file

@ -10,11 +10,11 @@ from datetime import date
from six.moves import range, queue as Queue
import requests
from helper import settings, stop, window
from jellyfin import Jellyfin
from jellyfin import api
from helper.exceptions import HTTPException
from helper import LazyLogger
from .helper import settings, stop, window, LazyLogger
from .jellyfin import Jellyfin
from .jellyfin import api
from .helper.exceptions import HTTPException
#################################################################################################

View file

@ -3,19 +3,11 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import logging
from kodi_six import xbmc, xbmcvfs
from helper import LazyLogger
from jellyfin import Jellyfin
from ..helper import LazyLogger
from ..jellyfin import Jellyfin
from .default import Events
from .service import Service
from .context import Context
#################################################################################################
LOG = LazyLogger(__name__)
#################################################################################################

View file

@ -8,12 +8,11 @@ import sys
from kodi_six import xbmc, xbmcaddon
import database
from dialogs import context
from helper import translate, settings, dialog
from helper import LazyLogger
from helper.utils import translate_path
from jellyfin import Jellyfin
from .. import database
from ..dialogs import context
from ..helper import translate, settings, dialog, LazyLogger
from ..helper.utils import translate_path
from ..jellyfin import Jellyfin
#################################################################################################

View file

@ -11,13 +11,12 @@ from six import iteritems
from six.moves.urllib.parse import parse_qsl, urlencode
from kodi_six import xbmc, xbmcvfs, xbmcgui, xbmcplugin, xbmcaddon
import client
from database import reset, get_sync, Database, jellyfin_db, get_credentials
from objects import Objects, Actions
from helper import translate, event, settings, window, dialog, api, JSONRPC
from helper.utils import JsonDebugPrinter, translate_path
from helper import LazyLogger
from jellyfin import Jellyfin
from .. import client
from ..database import reset, get_sync, Database, jellyfin_db, get_credentials
from ..objects import Objects, Actions
from ..helper import translate, event, settings, window, dialog, api, JSONRPC, LazyLogger
from ..helper.utils import JsonDebugPrinter, translate_path, kodi_version
from ..jellyfin import Jellyfin
#################################################################################################
@ -426,7 +425,7 @@ def browse_subfolders(media, view_id, server_id=None):
''' Display submenus for jellyfin views.
'''
from views import DYNNODES
from ..views import DYNNODES
view = Jellyfin(server_id).get_client().jellyfin.get_item(view_id)
xbmcplugin.setPluginCategory(PROCESS_HANDLE, view['Name'])
@ -792,9 +791,9 @@ def get_themes(api_client):
''' Add theme media locally, via strm. This is only for tv tunes.
If another script is used, adjust this code.
'''
from helper.utils import normalize_string
from helper.playutils import PlayUtils
from helper.xmls import tvtunes_nfo
from ..helper.utils import normalize_string
from ..helper.playutils import PlayUtils
from ..helper.xmls import tvtunes_nfo
library = translate_path("special://profile/addon_data/plugin.video.jellyfin/library")
play = settings('useDirectPaths') == "1"
@ -863,7 +862,7 @@ def delete_item():
''' Delete keymap action.
'''
import context
from . import context
context.Context(delete=True)
@ -872,10 +871,10 @@ def backup():
''' Jellyfin backup.
'''
from helper.utils import delete_folder, copytree
from ..helper.utils import delete_folder, copytree
path = settings('backupPath')
folder_name = "Kodi%s.%s" % (xbmc.getInfoLabel('System.BuildVersion')[:2], xbmc.getInfoLabel('System.Date(dd-mm-yy)'))
folder_name = "Kodi%s.%s" % (kodi_version(), xbmc.getInfoLabel('System.Date(dd-mm-yy)'))
folder_name = dialog("input", heading=translate(33089), defaultt=folder_name)
if not folder_name:

View file

@ -12,16 +12,15 @@ import _strptime # noqa:F401
from kodi_six import xbmc, xbmcgui
from six.moves import reload_module as reload
import objects
import connect
import client
import library
import monitor
from views import Views
from helper import translate, window, settings, event, dialog, set_addon_mode
from helper.utils import JsonDebugPrinter, translate_path
from jellyfin import Jellyfin
from helper import LazyLogger
from .. import objects
from .. import connect
from .. import client
from .. import library
from .. import monitor
from ..views import Views
from ..helper import translate, window, settings, event, dialog, set_addon_mode, LazyLogger
from ..helper.utils import JsonDebugPrinter, translate_path
from ..jellyfin import Jellyfin
#################################################################################################

View file

@ -8,14 +8,12 @@ import datetime
from kodi_six import xbmc
import downloader as server
import helper.xmls as xmls
from objects import Movies, TVShows, MusicVideos, Music
from database import Database, get_sync, save_sync, jellyfin_db
from helper import translate, settings, window, progress, dialog
from helper.utils import get_screensaver, set_screensaver
from helper import LazyLogger
from helper.exceptions import LibraryException, PathValidationException
from . import downloader as server
from .objects import Movies, TVShows, MusicVideos, Music
from .database import Database, get_sync, save_sync, jellyfin_db
from .helper import translate, settings, window, progress, dialog, LazyLogger, xmls
from .helper.utils import get_screensaver, set_screensaver
from .helper.exceptions import LibraryException, PathValidationException
##################################################################################################

View file

@ -3,9 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from helper import LazyLogger
from . import settings
from . import settings, LazyLogger
##################################################################################################

View file

@ -14,6 +14,6 @@ class LazyLogger(object):
def __getattr__(self, name):
if self.__logger is None:
from helper.loghandler import getLogger
from .loghandler import getLogger
self.__logger = getLogger(self.__logger_name)
return getattr(self.__logger, name)

View file

@ -10,12 +10,9 @@ import traceback
from six import ensure_text
from kodi_six import xbmc, xbmcaddon
import database
from helper import get_filesystem_encoding
from helper.utils import translate_path
from . import settings
from . import kodi_version
from .. import database
from . import get_filesystem_encoding, settings, kodi_version
from .utils import translate_path
##################################################################################################

View file

@ -7,18 +7,19 @@ import enum
import os
from uuid import uuid4
import requests
from kodi_six import xbmc, xbmcvfs
import client
import requests
from helper import LazyLogger
from helper.utils import translate_path
from .. import client
from .utils import translate_path
from . import translate, settings, window, dialog, api
from . import translate, settings, window, dialog, api, LazyLogger
#################################################################################################
LOG = LazyLogger(__name__)
class Transcode(enum.IntEnum):
Enabled = 0
Audio = 1
@ -607,6 +608,7 @@ class PlayUtils(object):
subs_streams.append(index)
skip_dialog = Transcode(int(settings('skipDialogTranscode') or 0))
def get_track_title(track_index):
return streams[track_index]['DisplayTitle'] or ("Track %s" % track_index)

View file

@ -5,7 +5,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from kodi_six import xbmc, xbmcaddon
from helper import LazyLogger
from . import LazyLogger
##################################################################################################

View file

@ -34,7 +34,10 @@ def addon_id():
def kodi_version():
return int(xbmc.getInfoLabel('System.BuildVersion').split('.')[0])
# Kodistubs returns empty string, causing Python 3 tests to choke on int()
# TODO: Make Kodistubs version configurable for testing purposes
version_string = xbmc.getInfoLabel('System.BuildVersion') or "19.1 (19.1.0) Git:20210509-85e05228b4"
return int(version_string.split(' ', 1)[0].split('.', 1)[0])
def window(key, value=None, clear=False, window_id=10000):
@ -537,7 +540,7 @@ def get_filesystem_encoding():
def find_library(server, item):
from database import get_sync
from ..database import get_sync
sync = get_sync()
@ -549,6 +552,7 @@ def find_library(server, item):
LOG.error('No ancestor found, not syncing item with ID: {}'.format(item['Id']))
return {}
def translate_path(path):
'''
Use new library location for translate path starting in Kodi 19
@ -559,4 +563,3 @@ def translate_path(path):
return xbmcvfs.translatePath(path)
else:
return xbmc.translatePath(path)

View file

@ -5,7 +5,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from kodi_six import xbmcgui
from helper import LazyLogger
from . import LazyLogger
from .utils import should_stop
from .exceptions import LibraryException

View file

@ -8,10 +8,8 @@ import xml.etree.ElementTree as etree
from kodi_six import xbmc
from helper import LazyLogger
from helper.utils import translate_path
from . import translate, dialog, settings
from .utils import translate_path
from . import translate, dialog, settings, LazyLogger
#################################################################################################

View file

@ -3,9 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import logging
from helper import has_attribute, LazyLogger
from ..helper import has_attribute, LazyLogger
from .client import JellyfinClient
@ -35,7 +33,7 @@ class Jellyfin(object):
''' This is your Jellyfinclient, you can create more than one. The server_id is only a temporary thing
to communicate with the JellyfinClient().
from jellyfin import Jellyfin
from jellyfin_kodi.jellyfin import Jellyfin
Jellyfin('123456').config.data['app']

View file

@ -5,8 +5,8 @@ import json
import requests
from helper.utils import settings
from helper import LazyLogger
from ..helper.utils import settings
from ..helper import LazyLogger
from six import ensure_str

View file

@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
from helper import LazyLogger
from ..helper import LazyLogger
from . import api
from .configuration import Config

View file

@ -7,7 +7,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
from helper import LazyLogger
from ..helper import LazyLogger
#################################################################################################

View file

@ -11,7 +11,7 @@ import traceback
import urllib3
from helper import LazyLogger
from ..helper import LazyLogger
from .credentials import Credentials
from .api import API

View file

@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import time
from datetime import datetime
from helper import LazyLogger
from ..helper import LazyLogger
#################################################################################################

View file

@ -8,10 +8,10 @@ import time
import requests
from six import string_types, ensure_str
from helper.utils import JsonDebugPrinter
from helper import LazyLogger
from helper.exceptions import HTTPException
from jellyfin.utils import clean_none_dict_values
from ..helper.utils import JsonDebugPrinter
from ..helper import LazyLogger
from ..helper.exceptions import HTTPException
from .utils import clean_none_dict_values
#################################################################################################

View file

@ -8,7 +8,7 @@ import threading
from kodi_six import xbmc
from helper import LazyLogger
from ..helper import LazyLogger
# If numpy is installed, the websockets library tries to use it, and then
# kodi hard crashes for reasons I don't even want to pretend to understand

View file

@ -10,16 +10,15 @@ from six.moves import queue as Queue
from kodi_six import xbmc, xbmcgui
from objects import Movies, TVShows, MusicVideos, Music
from database import Database, jellyfin_db, get_sync, save_sync
from full_sync import FullSync
from views import Views
from downloader import GetItemWorker
from helper import translate, api, stop, settings, window, dialog, event
from helper.utils import split_list, set_screensaver, get_screensaver
from helper.exceptions import LibraryException
from jellyfin import Jellyfin
from helper import LazyLogger
from .objects import Movies, TVShows, MusicVideos, Music
from .database import Database, jellyfin_db, get_sync, save_sync
from .full_sync import FullSync
from .views import Views
from .downloader import GetItemWorker
from .helper import translate, api, stop, settings, window, dialog, event, LazyLogger
from .helper.utils import split_list, set_screensaver, get_screensaver
from .helper.exceptions import LibraryException
from .jellyfin import Jellyfin
##################################################################################################

View file

@ -9,14 +9,14 @@ import threading
from kodi_six import xbmc
import connect
import player
from client import get_device_id
from objects import PlaylistWorker, on_play, on_update, special_listener
from helper import translate, settings, window, dialog, api, JSONRPC
from helper.utils import JsonDebugPrinter
from jellyfin import Jellyfin
from helper import LazyLogger
from . import connect
from . import player
from .client import get_device_id
from .objects import PlaylistWorker, on_play, on_update, special_listener
from .helper import translate, settings, window, dialog, api, JSONRPC
from .helper.utils import JsonDebugPrinter
from .jellyfin import Jellyfin
from .helper import LazyLogger
#################################################################################################

View file

@ -10,12 +10,12 @@ from datetime import timedelta
from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon
import database
from helper import translate, playutils, api, window, settings, dialog
from dialogs import resume
from helper import LazyLogger
from jellyfin import Jellyfin
from helper.utils import translate_path
from .. import database
from ..helper import translate, playutils, api, window, settings, dialog
from ..dialogs import resume
from ..helper import LazyLogger
from ..jellyfin import Jellyfin
from ..helper.utils import translate_path
from .obj import Objects

View file

@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
from helper import LazyLogger
from ...helper import LazyLogger
from . import queries as QU

View file

@ -3,8 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from helper import values
from helper import LazyLogger
from ...helper import values, LazyLogger
from . import artwork
from . import queries as QU

View file

@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from helper import LazyLogger
from ...helper import LazyLogger
from .kodi import Kodi
from . import queries as QU

View file

@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from helper import LazyLogger
from ...helper import LazyLogger
from . import queries_music as QU
from .kodi import Kodi

View file

@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from helper import LazyLogger
from ...helper import LazyLogger
from . import queries as QU
from .kodi import Kodi

View file

@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from helper import LazyLogger
from ...helper import LazyLogger
from . import queries as QU
from .kodi import Kodi

View file

@ -6,12 +6,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera
from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
import downloader as server
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, values, Local
from helper import LazyLogger
from helper.utils import find_library
from helper.exceptions import PathValidationException
from .. import downloader as server
from ..database import jellyfin_db, queries as QUEM
from ..helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, values, Local
from ..helper import LazyLogger
from ..helper.utils import find_library
from ..helper.exceptions import PathValidationException
from .obj import Objects
from .kodi import Movies as KodiDb, queries as QU

View file

@ -5,11 +5,10 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import datetime
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, values, Local
from helper import LazyLogger
from helper.utils import find_library
from helper.exceptions import PathValidationException
from ..database import jellyfin_db, queries as QUEM
from ..helper import api, stop, validate, jellyfin_item, values, Local, LazyLogger
from ..helper.utils import find_library
from ..helper.exceptions import PathValidationException
from .obj import Objects
from .kodi import Music as KodiDb, queries_music as QU

View file

@ -9,11 +9,10 @@ import re
from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, values, Local
from helper import LazyLogger
from helper.utils import find_library
from helper.exceptions import PathValidationException
from ..database import jellyfin_db, queries as QUEM
from ..helper import api, stop, validate, jellyfin_item, values, Local, LazyLogger
from ..helper.utils import find_library
from ..helper.exceptions import PathValidationException
from .obj import Objects
from .kodi import MusicVideos as KodiDb, queries as QU

View file

@ -8,7 +8,7 @@ import os
from six import iteritems, ensure_text
from helper import LazyLogger, get_filesystem_encoding
from ..helper import LazyLogger, get_filesystem_encoding
##################################################################################################

View file

@ -9,12 +9,12 @@ from ntpath import dirname
from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
import downloader as server
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, values, Local
from helper import LazyLogger
from helper.utils import find_library
from helper.exceptions import PathValidationException
from .. import downloader as server
from ..database import jellyfin_db, queries as QUEM
from ..helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, values, Local
from ..helper import LazyLogger
from ..helper.utils import find_library
from ..helper.exceptions import PathValidationException
from .obj import Objects
from .kodi import TVShows as KodiDb, queries as QU

View file

@ -3,8 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
from helper import JSONRPC
from helper import LazyLogger
from ..helper import JSONRPC
from ..helper import LazyLogger
#################################################################################################

View file

@ -7,11 +7,11 @@ import os
from kodi_six import xbmc, xbmcvfs
from objects.obj import Objects
from helper import translate, api, window, settings, dialog, event, JSONRPC
from jellyfin import Jellyfin
from helper import LazyLogger
from helper.utils import translate_path
from .objects.obj import Objects
from .helper import translate, api, window, settings, dialog, event, JSONRPC
from .jellyfin import Jellyfin
from .helper import LazyLogger
from .helper.utils import translate_path
#################################################################################################

View file

@ -7,13 +7,13 @@ import os
import xml.etree.ElementTree as etree
from six.moves.urllib.parse import urlencode
from kodi_six import xbmc, xbmcvfs
from kodi_six import xbmcvfs
from database import Database, jellyfin_db, get_sync, save_sync
from helper import translate, api, window, event
from jellyfin import Jellyfin
from helper import LazyLogger
from helper.utils import translate_path
from .database import Database, jellyfin_db, get_sync, save_sync
from .helper import translate, api, window, event
from .jellyfin import Jellyfin
from .helper import LazyLogger
from .helper.utils import translate_path
#################################################################################################

View file

@ -3,28 +3,13 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import os
import threading
import sys
from kodi_six import xbmc, xbmcaddon, xbmcvfs
from kodi_six import xbmc
#################################################################################################
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
__addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin')
if kodi_version > 18:
__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
else:
__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi'))
sys.path.insert(0, __base__)
#################################################################################################
from entrypoint import Service # noqa: E402
from helper.utils import settings # noqa: E402
from helper import LazyLogger # noqa: E402
from jellyfin_kodi.entrypoint import Service
from jellyfin_kodi.helper.utils import settings
from jellyfin_kodi.helper import LazyLogger
#################################################################################################

View file

@ -1,10 +1,6 @@
import sys
import pytest
sys.path.insert(0, 'jellyfin_kodi')
from jellyfin.utils import clean_none_dict_values # noqa: E402
from jellyfin_kodi.jellyfin.utils import clean_none_dict_values
@pytest.mark.parametrize("obj,expected", [

View file

@ -1,13 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
import sys
import pytest
sys.path.insert(0, 'jellyfin_kodi')
from helper.utils import values # noqa: E402
from jellyfin_kodi.helper.utils import values
item1 = {'foo': 123, 'bar': 456, 'baz': 789}

View file

@ -13,12 +13,7 @@ testpaths =
tests
[coverage:run]
source =
jellyfin_kodi
context.py
context_play.py
default.py
service.py
source = .
omit =
tests/*
build.py

View file

@ -0,0 +1 @@
def kodi_version(self) -> int: ...