From 84b8093171fb43cb2c834fb980576485e743faf1 Mon Sep 17 00:00:00 2001 From: TrueTechy Date: Fri, 1 Nov 2019 00:43:20 +0000 Subject: [PATCH 1/2] Begin restructing, fixed some issues related to movement --- context.py | 2 +- context_play.py | 2 +- default.py | 2 +- {resources/lib => jellyfin_kodi}/__init__.py | 0 {resources/lib => jellyfin_kodi}/client.py | 0 {resources/lib => jellyfin_kodi}/connect.py | 0 .../lib => jellyfin_kodi}/database/__init__.py | 0 .../database/jellyfin_db.py | 0 .../lib => jellyfin_kodi}/database/queries.py | 0 .../lib => jellyfin_kodi}/dialogs/__init__.py | 0 .../lib => jellyfin_kodi}/dialogs/context.py | 0 .../lib => jellyfin_kodi}/dialogs/loginmanual.py | 0 .../lib => jellyfin_kodi}/dialogs/resume.py | 0 .../dialogs/serverconnect.py | 0 .../dialogs/servermanual.py | 0 .../dialogs/usersconnect.py | 0 {resources/lib => jellyfin_kodi}/downloader.py | 0 .../lib => jellyfin_kodi}/entrypoint/__init__.py | 0 .../lib => jellyfin_kodi}/entrypoint/context.py | 0 .../lib => jellyfin_kodi}/entrypoint/default.py | 0 .../lib => jellyfin_kodi}/entrypoint/service.py | 0 {resources/lib => jellyfin_kodi}/full_sync.py | 0 .../lib => jellyfin_kodi}/helper/__init__.py | 1 + {resources/lib => jellyfin_kodi}/helper/api.py | 0 .../lib => jellyfin_kodi}/helper/exceptions.py | 0 .../lib => jellyfin_kodi}/helper/loghandler.py | 0 .../lib => jellyfin_kodi}/helper/playutils.py | 0 .../lib => jellyfin_kodi}/helper/translate.py | 0 {resources/lib => jellyfin_kodi}/helper/utils.py | 9 ++++++++- .../lib => jellyfin_kodi}/helper/wrapper.py | 0 {resources/lib => jellyfin_kodi}/helper/xmls.py | 0 .../lib => jellyfin_kodi}/jellyfin/__init__.py | 2 +- .../lib => jellyfin_kodi}/jellyfin/client.py | 0 .../jellyfin/core/__init__.py | 0 .../lib => jellyfin_kodi}/jellyfin/core/api.py | 0 .../jellyfin/core/configuration.py | 0 .../jellyfin/core/connection_manager.py | 0 .../jellyfin/core/credentials.py | 0 .../jellyfin/core/exceptions.py | 0 .../lib => jellyfin_kodi}/jellyfin/core/http.py | 0 .../jellyfin/core/ws_client.py | 2 +- .../jellyfin}/websocket.py | 0 {resources/lib => jellyfin_kodi}/library.py | 0 {resources/lib => jellyfin_kodi}/monitor.py | 0 .../lib => jellyfin_kodi}/objects/__init__.py | 0 .../lib => jellyfin_kodi}/objects/actions.py | 0 .../objects/kodi/__init__.py | 0 .../objects/kodi/artwork.py | 0 .../lib => jellyfin_kodi}/objects/kodi/kodi.py | 0 .../lib => jellyfin_kodi}/objects/kodi/movies.py | 0 .../lib => jellyfin_kodi}/objects/kodi/music.py | 0 .../objects/kodi/musicvideos.py | 0 .../objects/kodi/queries.py | 0 .../objects/kodi/queries_music.py | 0 .../objects/kodi/queries_texture.py | 0 .../objects/kodi/tvshows.py | 0 .../lib => jellyfin_kodi}/objects/movies.py | 0 .../lib => jellyfin_kodi}/objects/music.py | 0 .../lib => jellyfin_kodi}/objects/musicvideos.py | 0 {resources/lib => jellyfin_kodi}/objects/obj.py | 0 .../lib => jellyfin_kodi}/objects/obj_map.json | 0 .../lib => jellyfin_kodi}/objects/tvshows.py | 0 .../lib => jellyfin_kodi}/objects/utils.py | 0 {resources/lib => jellyfin_kodi}/player.py | 0 {resources/lib => jellyfin_kodi}/setup.py | 0 {resources/lib => jellyfin_kodi}/views.py | 0 {resources/lib => jellyfin_kodi}/webservice.py | 0 resources/__init__.py | 1 - resources/lib/jellyfin/helpers/__init__.py | 7 ------- resources/lib/jellyfin/helpers/utils.py | 16 ---------------- resources/lib/jellyfin/resources/__init__.py | 0 service.py | 6 ++---- 72 files changed, 16 insertions(+), 34 deletions(-) rename {resources/lib => jellyfin_kodi}/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/client.py (100%) rename {resources/lib => jellyfin_kodi}/connect.py (100%) rename {resources/lib => jellyfin_kodi}/database/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/database/jellyfin_db.py (100%) rename {resources/lib => jellyfin_kodi}/database/queries.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/context.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/loginmanual.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/resume.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/serverconnect.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/servermanual.py (100%) rename {resources/lib => jellyfin_kodi}/dialogs/usersconnect.py (100%) rename {resources/lib => jellyfin_kodi}/downloader.py (100%) rename {resources/lib => jellyfin_kodi}/entrypoint/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/entrypoint/context.py (100%) rename {resources/lib => jellyfin_kodi}/entrypoint/default.py (100%) rename {resources/lib => jellyfin_kodi}/entrypoint/service.py (100%) rename {resources/lib => jellyfin_kodi}/full_sync.py (100%) rename {resources/lib => jellyfin_kodi}/helper/__init__.py (95%) rename {resources/lib => jellyfin_kodi}/helper/api.py (100%) rename {resources/lib => jellyfin_kodi}/helper/exceptions.py (100%) rename {resources/lib => jellyfin_kodi}/helper/loghandler.py (100%) rename {resources/lib => jellyfin_kodi}/helper/playutils.py (100%) rename {resources/lib => jellyfin_kodi}/helper/translate.py (100%) rename {resources/lib => jellyfin_kodi}/helper/utils.py (98%) rename {resources/lib => jellyfin_kodi}/helper/wrapper.py (100%) rename {resources/lib => jellyfin_kodi}/helper/xmls.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/__init__.py (98%) rename {resources/lib => jellyfin_kodi}/jellyfin/client.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/api.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/configuration.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/connection_manager.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/credentials.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/exceptions.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/http.py (100%) rename {resources/lib => jellyfin_kodi}/jellyfin/core/ws_client.py (98%) rename {resources/lib/jellyfin/resources => jellyfin_kodi/jellyfin}/websocket.py (100%) rename {resources/lib => jellyfin_kodi}/library.py (100%) rename {resources/lib => jellyfin_kodi}/monitor.py (100%) rename {resources/lib => jellyfin_kodi}/objects/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/objects/actions.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/__init__.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/artwork.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/kodi.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/movies.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/music.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/musicvideos.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/queries.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/queries_music.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/queries_texture.py (100%) rename {resources/lib => jellyfin_kodi}/objects/kodi/tvshows.py (100%) rename {resources/lib => jellyfin_kodi}/objects/movies.py (100%) rename {resources/lib => jellyfin_kodi}/objects/music.py (100%) rename {resources/lib => jellyfin_kodi}/objects/musicvideos.py (100%) rename {resources/lib => jellyfin_kodi}/objects/obj.py (100%) rename {resources/lib => jellyfin_kodi}/objects/obj_map.json (100%) rename {resources/lib => jellyfin_kodi}/objects/tvshows.py (100%) rename {resources/lib => jellyfin_kodi}/objects/utils.py (100%) rename {resources/lib => jellyfin_kodi}/player.py (100%) rename {resources/lib => jellyfin_kodi}/setup.py (100%) rename {resources/lib => jellyfin_kodi}/views.py (100%) rename {resources/lib => jellyfin_kodi}/webservice.py (100%) delete mode 100644 resources/__init__.py delete mode 100644 resources/lib/jellyfin/helpers/__init__.py delete mode 100644 resources/lib/jellyfin/helpers/utils.py delete mode 100644 resources/lib/jellyfin/resources/__init__.py diff --git a/context.py b/context.py index ec3c3821..8e165a68 100644 --- a/context.py +++ b/context.py @@ -12,7 +12,7 @@ import xbmcaddon ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8') +__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')).decode('utf-8') sys.path.insert(0, __base__) diff --git a/context_play.py b/context_play.py index 6593b5c2..1bb53e7d 100644 --- a/context_play.py +++ b/context_play.py @@ -12,7 +12,7 @@ import xbmcaddon ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8') +__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')).decode('utf-8') sys.path.insert(0, __base__) diff --git a/default.py b/default.py index e6f7d101..f2251509 100644 --- a/default.py +++ b/default.py @@ -12,7 +12,7 @@ import xbmcaddon ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8') +__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')).decode('utf-8') sys.path.insert(0, __base__) diff --git a/resources/lib/__init__.py b/jellyfin_kodi/__init__.py similarity index 100% rename from resources/lib/__init__.py rename to jellyfin_kodi/__init__.py diff --git a/resources/lib/client.py b/jellyfin_kodi/client.py similarity index 100% rename from resources/lib/client.py rename to jellyfin_kodi/client.py diff --git a/resources/lib/connect.py b/jellyfin_kodi/connect.py similarity index 100% rename from resources/lib/connect.py rename to jellyfin_kodi/connect.py diff --git a/resources/lib/database/__init__.py b/jellyfin_kodi/database/__init__.py similarity index 100% rename from resources/lib/database/__init__.py rename to jellyfin_kodi/database/__init__.py diff --git a/resources/lib/database/jellyfin_db.py b/jellyfin_kodi/database/jellyfin_db.py similarity index 100% rename from resources/lib/database/jellyfin_db.py rename to jellyfin_kodi/database/jellyfin_db.py diff --git a/resources/lib/database/queries.py b/jellyfin_kodi/database/queries.py similarity index 100% rename from resources/lib/database/queries.py rename to jellyfin_kodi/database/queries.py diff --git a/resources/lib/dialogs/__init__.py b/jellyfin_kodi/dialogs/__init__.py similarity index 100% rename from resources/lib/dialogs/__init__.py rename to jellyfin_kodi/dialogs/__init__.py diff --git a/resources/lib/dialogs/context.py b/jellyfin_kodi/dialogs/context.py similarity index 100% rename from resources/lib/dialogs/context.py rename to jellyfin_kodi/dialogs/context.py diff --git a/resources/lib/dialogs/loginmanual.py b/jellyfin_kodi/dialogs/loginmanual.py similarity index 100% rename from resources/lib/dialogs/loginmanual.py rename to jellyfin_kodi/dialogs/loginmanual.py diff --git a/resources/lib/dialogs/resume.py b/jellyfin_kodi/dialogs/resume.py similarity index 100% rename from resources/lib/dialogs/resume.py rename to jellyfin_kodi/dialogs/resume.py diff --git a/resources/lib/dialogs/serverconnect.py b/jellyfin_kodi/dialogs/serverconnect.py similarity index 100% rename from resources/lib/dialogs/serverconnect.py rename to jellyfin_kodi/dialogs/serverconnect.py diff --git a/resources/lib/dialogs/servermanual.py b/jellyfin_kodi/dialogs/servermanual.py similarity index 100% rename from resources/lib/dialogs/servermanual.py rename to jellyfin_kodi/dialogs/servermanual.py diff --git a/resources/lib/dialogs/usersconnect.py b/jellyfin_kodi/dialogs/usersconnect.py similarity index 100% rename from resources/lib/dialogs/usersconnect.py rename to jellyfin_kodi/dialogs/usersconnect.py diff --git a/resources/lib/downloader.py b/jellyfin_kodi/downloader.py similarity index 100% rename from resources/lib/downloader.py rename to jellyfin_kodi/downloader.py diff --git a/resources/lib/entrypoint/__init__.py b/jellyfin_kodi/entrypoint/__init__.py similarity index 100% rename from resources/lib/entrypoint/__init__.py rename to jellyfin_kodi/entrypoint/__init__.py diff --git a/resources/lib/entrypoint/context.py b/jellyfin_kodi/entrypoint/context.py similarity index 100% rename from resources/lib/entrypoint/context.py rename to jellyfin_kodi/entrypoint/context.py diff --git a/resources/lib/entrypoint/default.py b/jellyfin_kodi/entrypoint/default.py similarity index 100% rename from resources/lib/entrypoint/default.py rename to jellyfin_kodi/entrypoint/default.py diff --git a/resources/lib/entrypoint/service.py b/jellyfin_kodi/entrypoint/service.py similarity index 100% rename from resources/lib/entrypoint/service.py rename to jellyfin_kodi/entrypoint/service.py diff --git a/resources/lib/full_sync.py b/jellyfin_kodi/full_sync.py similarity index 100% rename from resources/lib/full_sync.py rename to jellyfin_kodi/full_sync.py diff --git a/resources/lib/helper/__init__.py b/jellyfin_kodi/helper/__init__.py similarity index 95% rename from resources/lib/helper/__init__.py rename to jellyfin_kodi/helper/__init__.py index 4e279cd6..aaafd384 100644 --- a/resources/lib/helper/__init__.py +++ b/jellyfin_kodi/helper/__init__.py @@ -17,6 +17,7 @@ from utils import compare_version from utils import unzip from utils import create_id from utils import convert_to_local as Local +from utils import has_attribute from wrapper import progress from wrapper import catch diff --git a/resources/lib/helper/api.py b/jellyfin_kodi/helper/api.py similarity index 100% rename from resources/lib/helper/api.py rename to jellyfin_kodi/helper/api.py diff --git a/resources/lib/helper/exceptions.py b/jellyfin_kodi/helper/exceptions.py similarity index 100% rename from resources/lib/helper/exceptions.py rename to jellyfin_kodi/helper/exceptions.py diff --git a/resources/lib/helper/loghandler.py b/jellyfin_kodi/helper/loghandler.py similarity index 100% rename from resources/lib/helper/loghandler.py rename to jellyfin_kodi/helper/loghandler.py diff --git a/resources/lib/helper/playutils.py b/jellyfin_kodi/helper/playutils.py similarity index 100% rename from resources/lib/helper/playutils.py rename to jellyfin_kodi/helper/playutils.py diff --git a/resources/lib/helper/translate.py b/jellyfin_kodi/helper/translate.py similarity index 100% rename from resources/lib/helper/translate.py rename to jellyfin_kodi/helper/translate.py diff --git a/resources/lib/helper/utils.py b/jellyfin_kodi/helper/utils.py similarity index 98% rename from resources/lib/helper/utils.py rename to jellyfin_kodi/helper/utils.py index 058349c1..b568e276 100644 --- a/resources/lib/helper/utils.py +++ b/jellyfin_kodi/helper/utils.py @@ -19,7 +19,7 @@ import xbmcaddon import xbmcgui import xbmcvfs -from .translate import _ +from translate import _ ################################################################################################# @@ -484,3 +484,10 @@ def convert_to_local(date): LOG.exception(error) return str(date) + +def has_attribute(obj, name): + try: + object.__getattribute__(obj, name) + return True + except AttributeError: + return False diff --git a/resources/lib/helper/wrapper.py b/jellyfin_kodi/helper/wrapper.py similarity index 100% rename from resources/lib/helper/wrapper.py rename to jellyfin_kodi/helper/wrapper.py diff --git a/resources/lib/helper/xmls.py b/jellyfin_kodi/helper/xmls.py similarity index 100% rename from resources/lib/helper/xmls.py rename to jellyfin_kodi/helper/xmls.py diff --git a/resources/lib/jellyfin/__init__.py b/jellyfin_kodi/jellyfin/__init__.py similarity index 98% rename from resources/lib/jellyfin/__init__.py rename to jellyfin_kodi/jellyfin/__init__.py index e8da2b1a..cffb1e6a 100644 --- a/resources/lib/jellyfin/__init__.py +++ b/jellyfin_kodi/jellyfin/__init__.py @@ -5,7 +5,7 @@ import logging from client import JellyfinClient -from helpers import has_attribute +from helper import has_attribute ################################################################################################# diff --git a/resources/lib/jellyfin/client.py b/jellyfin_kodi/jellyfin/client.py similarity index 100% rename from resources/lib/jellyfin/client.py rename to jellyfin_kodi/jellyfin/client.py diff --git a/resources/lib/jellyfin/core/__init__.py b/jellyfin_kodi/jellyfin/core/__init__.py similarity index 100% rename from resources/lib/jellyfin/core/__init__.py rename to jellyfin_kodi/jellyfin/core/__init__.py diff --git a/resources/lib/jellyfin/core/api.py b/jellyfin_kodi/jellyfin/core/api.py similarity index 100% rename from resources/lib/jellyfin/core/api.py rename to jellyfin_kodi/jellyfin/core/api.py diff --git a/resources/lib/jellyfin/core/configuration.py b/jellyfin_kodi/jellyfin/core/configuration.py similarity index 100% rename from resources/lib/jellyfin/core/configuration.py rename to jellyfin_kodi/jellyfin/core/configuration.py diff --git a/resources/lib/jellyfin/core/connection_manager.py b/jellyfin_kodi/jellyfin/core/connection_manager.py similarity index 100% rename from resources/lib/jellyfin/core/connection_manager.py rename to jellyfin_kodi/jellyfin/core/connection_manager.py diff --git a/resources/lib/jellyfin/core/credentials.py b/jellyfin_kodi/jellyfin/core/credentials.py similarity index 100% rename from resources/lib/jellyfin/core/credentials.py rename to jellyfin_kodi/jellyfin/core/credentials.py diff --git a/resources/lib/jellyfin/core/exceptions.py b/jellyfin_kodi/jellyfin/core/exceptions.py similarity index 100% rename from resources/lib/jellyfin/core/exceptions.py rename to jellyfin_kodi/jellyfin/core/exceptions.py diff --git a/resources/lib/jellyfin/core/http.py b/jellyfin_kodi/jellyfin/core/http.py similarity index 100% rename from resources/lib/jellyfin/core/http.py rename to jellyfin_kodi/jellyfin/core/http.py diff --git a/resources/lib/jellyfin/core/ws_client.py b/jellyfin_kodi/jellyfin/core/ws_client.py similarity index 98% rename from resources/lib/jellyfin/core/ws_client.py rename to jellyfin_kodi/jellyfin/core/ws_client.py index 72c45c56..b51b45b1 100644 --- a/resources/lib/jellyfin/core/ws_client.py +++ b/jellyfin_kodi/jellyfin/core/ws_client.py @@ -8,7 +8,7 @@ import threading import xbmc -from ..resources import websocket +from .. import websocket ################################################################################################## diff --git a/resources/lib/jellyfin/resources/websocket.py b/jellyfin_kodi/jellyfin/websocket.py similarity index 100% rename from resources/lib/jellyfin/resources/websocket.py rename to jellyfin_kodi/jellyfin/websocket.py diff --git a/resources/lib/library.py b/jellyfin_kodi/library.py similarity index 100% rename from resources/lib/library.py rename to jellyfin_kodi/library.py diff --git a/resources/lib/monitor.py b/jellyfin_kodi/monitor.py similarity index 100% rename from resources/lib/monitor.py rename to jellyfin_kodi/monitor.py diff --git a/resources/lib/objects/__init__.py b/jellyfin_kodi/objects/__init__.py similarity index 100% rename from resources/lib/objects/__init__.py rename to jellyfin_kodi/objects/__init__.py diff --git a/resources/lib/objects/actions.py b/jellyfin_kodi/objects/actions.py similarity index 100% rename from resources/lib/objects/actions.py rename to jellyfin_kodi/objects/actions.py diff --git a/resources/lib/objects/kodi/__init__.py b/jellyfin_kodi/objects/kodi/__init__.py similarity index 100% rename from resources/lib/objects/kodi/__init__.py rename to jellyfin_kodi/objects/kodi/__init__.py diff --git a/resources/lib/objects/kodi/artwork.py b/jellyfin_kodi/objects/kodi/artwork.py similarity index 100% rename from resources/lib/objects/kodi/artwork.py rename to jellyfin_kodi/objects/kodi/artwork.py diff --git a/resources/lib/objects/kodi/kodi.py b/jellyfin_kodi/objects/kodi/kodi.py similarity index 100% rename from resources/lib/objects/kodi/kodi.py rename to jellyfin_kodi/objects/kodi/kodi.py diff --git a/resources/lib/objects/kodi/movies.py b/jellyfin_kodi/objects/kodi/movies.py similarity index 100% rename from resources/lib/objects/kodi/movies.py rename to jellyfin_kodi/objects/kodi/movies.py diff --git a/resources/lib/objects/kodi/music.py b/jellyfin_kodi/objects/kodi/music.py similarity index 100% rename from resources/lib/objects/kodi/music.py rename to jellyfin_kodi/objects/kodi/music.py diff --git a/resources/lib/objects/kodi/musicvideos.py b/jellyfin_kodi/objects/kodi/musicvideos.py similarity index 100% rename from resources/lib/objects/kodi/musicvideos.py rename to jellyfin_kodi/objects/kodi/musicvideos.py diff --git a/resources/lib/objects/kodi/queries.py b/jellyfin_kodi/objects/kodi/queries.py similarity index 100% rename from resources/lib/objects/kodi/queries.py rename to jellyfin_kodi/objects/kodi/queries.py diff --git a/resources/lib/objects/kodi/queries_music.py b/jellyfin_kodi/objects/kodi/queries_music.py similarity index 100% rename from resources/lib/objects/kodi/queries_music.py rename to jellyfin_kodi/objects/kodi/queries_music.py diff --git a/resources/lib/objects/kodi/queries_texture.py b/jellyfin_kodi/objects/kodi/queries_texture.py similarity index 100% rename from resources/lib/objects/kodi/queries_texture.py rename to jellyfin_kodi/objects/kodi/queries_texture.py diff --git a/resources/lib/objects/kodi/tvshows.py b/jellyfin_kodi/objects/kodi/tvshows.py similarity index 100% rename from resources/lib/objects/kodi/tvshows.py rename to jellyfin_kodi/objects/kodi/tvshows.py diff --git a/resources/lib/objects/movies.py b/jellyfin_kodi/objects/movies.py similarity index 100% rename from resources/lib/objects/movies.py rename to jellyfin_kodi/objects/movies.py diff --git a/resources/lib/objects/music.py b/jellyfin_kodi/objects/music.py similarity index 100% rename from resources/lib/objects/music.py rename to jellyfin_kodi/objects/music.py diff --git a/resources/lib/objects/musicvideos.py b/jellyfin_kodi/objects/musicvideos.py similarity index 100% rename from resources/lib/objects/musicvideos.py rename to jellyfin_kodi/objects/musicvideos.py diff --git a/resources/lib/objects/obj.py b/jellyfin_kodi/objects/obj.py similarity index 100% rename from resources/lib/objects/obj.py rename to jellyfin_kodi/objects/obj.py diff --git a/resources/lib/objects/obj_map.json b/jellyfin_kodi/objects/obj_map.json similarity index 100% rename from resources/lib/objects/obj_map.json rename to jellyfin_kodi/objects/obj_map.json diff --git a/resources/lib/objects/tvshows.py b/jellyfin_kodi/objects/tvshows.py similarity index 100% rename from resources/lib/objects/tvshows.py rename to jellyfin_kodi/objects/tvshows.py diff --git a/resources/lib/objects/utils.py b/jellyfin_kodi/objects/utils.py similarity index 100% rename from resources/lib/objects/utils.py rename to jellyfin_kodi/objects/utils.py diff --git a/resources/lib/player.py b/jellyfin_kodi/player.py similarity index 100% rename from resources/lib/player.py rename to jellyfin_kodi/player.py diff --git a/resources/lib/setup.py b/jellyfin_kodi/setup.py similarity index 100% rename from resources/lib/setup.py rename to jellyfin_kodi/setup.py diff --git a/resources/lib/views.py b/jellyfin_kodi/views.py similarity index 100% rename from resources/lib/views.py rename to jellyfin_kodi/views.py diff --git a/resources/lib/webservice.py b/jellyfin_kodi/webservice.py similarity index 100% rename from resources/lib/webservice.py rename to jellyfin_kodi/webservice.py diff --git a/resources/__init__.py b/resources/__init__.py deleted file mode 100644 index b93054b3..00000000 --- a/resources/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Dummy file to make this directory a package. diff --git a/resources/lib/jellyfin/helpers/__init__.py b/resources/lib/jellyfin/helpers/__init__.py deleted file mode 100644 index 453fa606..00000000 --- a/resources/lib/jellyfin/helpers/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ - -def has_attribute(obj, name): - try: - object.__getattribute__(obj, name) - return True - except AttributeError: - return False diff --git a/resources/lib/jellyfin/helpers/utils.py b/resources/lib/jellyfin/helpers/utils.py deleted file mode 100644 index 62848188..00000000 --- a/resources/lib/jellyfin/helpers/utils.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -################################################################################################# - -import logging -from uuid import uuid4 - -################################################################################################# - -LOG = logging.getLogger('JELLYFIN.' + __name__) - -################################################################################################# - - -def generate_client_id(): - return str("%012X" % uuid4()) diff --git a/resources/lib/jellyfin/resources/__init__.py b/resources/lib/jellyfin/resources/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/service.py b/service.py index 6f09fdab..f807e14f 100644 --- a/service.py +++ b/service.py @@ -13,14 +13,14 @@ import xbmcaddon ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'resources', 'lib')).decode('utf-8') +__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')).decode('utf-8') sys.path.insert(0, __base__) ################################################################################################# from entrypoint import Service # noqa: F402 -from helper import settings # noqa: F402 +from helper.utils import settings # noqa: F402 ################################################################################################# @@ -65,12 +65,10 @@ class ServiceManager(threading.Thread): if __name__ == "__main__": - LOG.info("-->[ service ]") LOG.info("Delay startup by %s seconds.", DELAY) while True: - if not settings('enableAddon.bool'): LOG.warning("Jellyfin for Kodi is not enabled.") From 7e8f34401d45ab5025e1e9e5e964d7933774481c Mon Sep 17 00:00:00 2001 From: TrueTechy Date: Sun, 3 Nov 2019 20:06:21 +0000 Subject: [PATCH 2/2] Remove Core folder --- jellyfin_kodi/connect.py | 4 ++-- jellyfin_kodi/dialogs/serverconnect.py | 2 +- jellyfin_kodi/dialogs/servermanual.py | 2 +- jellyfin_kodi/downloader.py | 4 ++-- jellyfin_kodi/jellyfin/{core => }/api.py | 0 jellyfin_kodi/jellyfin/client.py | 10 +++++----- jellyfin_kodi/jellyfin/{core => }/configuration.py | 0 .../jellyfin/{core => }/connection_manager.py | 0 jellyfin_kodi/jellyfin/core/__init__.py | 0 jellyfin_kodi/jellyfin/{core => }/credentials.py | 0 jellyfin_kodi/jellyfin/{core => }/exceptions.py | 0 jellyfin_kodi/jellyfin/{core => }/http.py | 0 jellyfin_kodi/jellyfin/{core => }/ws_client.py | 2 +- 13 files changed, 12 insertions(+), 12 deletions(-) rename jellyfin_kodi/jellyfin/{core => }/api.py (100%) rename jellyfin_kodi/jellyfin/{core => }/configuration.py (100%) rename jellyfin_kodi/jellyfin/{core => }/connection_manager.py (100%) delete mode 100644 jellyfin_kodi/jellyfin/core/__init__.py rename jellyfin_kodi/jellyfin/{core => }/credentials.py (100%) rename jellyfin_kodi/jellyfin/{core => }/exceptions.py (100%) rename jellyfin_kodi/jellyfin/{core => }/http.py (100%) rename jellyfin_kodi/jellyfin/{core => }/ws_client.py (98%) diff --git a/jellyfin_kodi/connect.py b/jellyfin_kodi/connect.py index 9d16f0ba..e05b5f9d 100644 --- a/jellyfin_kodi/connect.py +++ b/jellyfin_kodi/connect.py @@ -12,8 +12,8 @@ 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.core.connection_manager import CONNECTION_STATE -from jellyfin.core.exceptions import HTTPException +from jellyfin.connection_manager import CONNECTION_STATE +from jellyfin.exceptions import HTTPException ################################################################################################## diff --git a/jellyfin_kodi/dialogs/serverconnect.py b/jellyfin_kodi/dialogs/serverconnect.py index 349280b5..a1377fbf 100644 --- a/jellyfin_kodi/dialogs/serverconnect.py +++ b/jellyfin_kodi/dialogs/serverconnect.py @@ -8,7 +8,7 @@ import xbmc import xbmcgui from helper import _ -from jellyfin.core.connection_manager import CONNECTION_STATE +from jellyfin.connection_manager import CONNECTION_STATE ################################################################################################## diff --git a/jellyfin_kodi/dialogs/servermanual.py b/jellyfin_kodi/dialogs/servermanual.py index 314e9c28..a187ac66 100644 --- a/jellyfin_kodi/dialogs/servermanual.py +++ b/jellyfin_kodi/dialogs/servermanual.py @@ -10,7 +10,7 @@ import xbmcgui import xbmcaddon from helper import _, addon_id -from jellyfin.core.connection_manager import CONNECTION_STATE +from jellyfin.connection_manager import CONNECTION_STATE ################################################################################################## diff --git a/jellyfin_kodi/downloader.py b/jellyfin_kodi/downloader.py index a345ce00..fef18a4c 100644 --- a/jellyfin_kodi/downloader.py +++ b/jellyfin_kodi/downloader.py @@ -10,8 +10,8 @@ import xbmc import requests from helper import settings, stop, event, window, create_id from jellyfin import Jellyfin -from jellyfin.core import api -from jellyfin.core.exceptions import HTTPException +from jellyfin import api +from jellyfin.exceptions import HTTPException ################################################################################################# diff --git a/jellyfin_kodi/jellyfin/core/api.py b/jellyfin_kodi/jellyfin/api.py similarity index 100% rename from jellyfin_kodi/jellyfin/core/api.py rename to jellyfin_kodi/jellyfin/api.py diff --git a/jellyfin_kodi/jellyfin/client.py b/jellyfin_kodi/jellyfin/client.py index 7f03ff92..ee9db7fd 100644 --- a/jellyfin_kodi/jellyfin/client.py +++ b/jellyfin_kodi/jellyfin/client.py @@ -4,11 +4,11 @@ import logging -import core.api as api -from core.configuration import Config -from core.http import HTTP -from core.ws_client import WSClient -from core.connection_manager import ConnectionManager, CONNECTION_STATE +import api +from configuration import Config +from http import HTTP +from ws_client import WSClient +from connection_manager import ConnectionManager, CONNECTION_STATE ################################################################################################# diff --git a/jellyfin_kodi/jellyfin/core/configuration.py b/jellyfin_kodi/jellyfin/configuration.py similarity index 100% rename from jellyfin_kodi/jellyfin/core/configuration.py rename to jellyfin_kodi/jellyfin/configuration.py diff --git a/jellyfin_kodi/jellyfin/core/connection_manager.py b/jellyfin_kodi/jellyfin/connection_manager.py similarity index 100% rename from jellyfin_kodi/jellyfin/core/connection_manager.py rename to jellyfin_kodi/jellyfin/connection_manager.py diff --git a/jellyfin_kodi/jellyfin/core/__init__.py b/jellyfin_kodi/jellyfin/core/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/jellyfin_kodi/jellyfin/core/credentials.py b/jellyfin_kodi/jellyfin/credentials.py similarity index 100% rename from jellyfin_kodi/jellyfin/core/credentials.py rename to jellyfin_kodi/jellyfin/credentials.py diff --git a/jellyfin_kodi/jellyfin/core/exceptions.py b/jellyfin_kodi/jellyfin/exceptions.py similarity index 100% rename from jellyfin_kodi/jellyfin/core/exceptions.py rename to jellyfin_kodi/jellyfin/exceptions.py diff --git a/jellyfin_kodi/jellyfin/core/http.py b/jellyfin_kodi/jellyfin/http.py similarity index 100% rename from jellyfin_kodi/jellyfin/core/http.py rename to jellyfin_kodi/jellyfin/http.py diff --git a/jellyfin_kodi/jellyfin/core/ws_client.py b/jellyfin_kodi/jellyfin/ws_client.py similarity index 98% rename from jellyfin_kodi/jellyfin/core/ws_client.py rename to jellyfin_kodi/jellyfin/ws_client.py index b51b45b1..a2f1b8d8 100644 --- a/jellyfin_kodi/jellyfin/core/ws_client.py +++ b/jellyfin_kodi/jellyfin/ws_client.py @@ -8,7 +8,7 @@ import threading import xbmc -from .. import websocket +import websocket ##################################################################################################