Use module-relative imports

This commit is contained in:
Odd Stråbø 2021-10-10 20:38:25 +02:00
parent 086a704f24
commit 53c887d354
53 changed files with 166 additions and 195 deletions

View File

@ -3,8 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
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,8 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
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,8 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
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

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

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,13 @@ 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
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,7 +871,7 @@ 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)'))

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,14 +7,13 @@ 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
#################################################################################################

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

@ -537,7 +537,7 @@ def get_filesystem_encoding():
def find_library(server, item):
from database import get_sync
from ..database import get_sync
sync = get_sync()

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

@ -9,11 +9,11 @@ import xml.etree.ElementTree as etree
from six.moves.urllib.parse import urlencode
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

@ -7,9 +7,9 @@ import threading
from kodi_six import xbmc
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
#################################################################################################