mirror of
https://github.com/jellyfin/jellycon.git
synced 2024-11-27 00:00:24 +00:00
Copy translate_path from Jf4Kodi, fix LazyLogger
This commit is contained in:
parent
f507efdef7
commit
6126d617f5
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
|
||||||
from resources.lib.loghandler import LazyLogger
|
from resources.lib.lazylogger import LazyLogger
|
||||||
from resources.lib.functions import main_entry_point
|
from resources.lib.functions import main_entry_point
|
||||||
from resources.lib.tracking import set_timing_enabled
|
from resources.lib.tracking import set_timing_enabled
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import threading
|
|||||||
import xbmc
|
import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import xbmc
|
|||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .jsonrpc import JsonRpc, get_value
|
from .jsonrpc import JsonRpc, get_value
|
||||||
from .utils import translate_string, load_user_details
|
from .utils import translate_string, load_user_details
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
|
@ -8,12 +8,12 @@ import time
|
|||||||
from six.moves import cPickle
|
from six.moves import cPickle
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .item_functions import extract_item_info
|
from .item_functions import extract_item_info
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
from .tracking import timer
|
from .tracking import timer
|
||||||
from .filelock import FileLock
|
from .filelock import FileLock
|
||||||
from .utils import translate_string, load_user_details
|
from .utils import translate_string, load_user_details, translate_path
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
@ -39,7 +39,7 @@ class CacheItem:
|
|||||||
|
|
||||||
class DataManager:
|
class DataManager:
|
||||||
|
|
||||||
addon_dir = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
|
addon_dir = translate_path(xbmcaddon.Addon().getAddonInfo('profile'))
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
self.user_details = load_user_details()
|
self.user_details = load_user_details()
|
||||||
@ -253,7 +253,7 @@ class CacheManagerThread(threading.Thread):
|
|||||||
def clear_cached_server_data():
|
def clear_cached_server_data():
|
||||||
log.debug("clear_cached_server_data() called")
|
log.debug("clear_cached_server_data() called")
|
||||||
|
|
||||||
addon_dir = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
|
addon_dir = translate_path(xbmcaddon.Addon().getAddonInfo('profile'))
|
||||||
dirs, files = xbmcvfs.listdir(addon_dir)
|
dirs, files = xbmcvfs.listdir(addon_dir)
|
||||||
|
|
||||||
del_count = 0
|
del_count = 0
|
||||||
@ -271,7 +271,7 @@ def clear_cached_server_data():
|
|||||||
def clear_old_cache_data():
|
def clear_old_cache_data():
|
||||||
log.debug("clear_old_cache_data() : called")
|
log.debug("clear_old_cache_data() : called")
|
||||||
|
|
||||||
addon_dir = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
|
addon_dir = translate_path(xbmcaddon.Addon().getAddonInfo('profile'))
|
||||||
dirs, files = xbmcvfs.listdir(addon_dir)
|
dirs, files = xbmcvfs.listdir(addon_dir)
|
||||||
|
|
||||||
del_count = 0
|
del_count = 0
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||||||
|
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .utils import translate_string, send_event_notification
|
from .utils import translate_string, send_event_notification
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
@ -10,7 +10,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .datamanager import DataManager
|
from .datamanager import DataManager
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .item_functions import add_gui_item, ItemDetails
|
from .item_functions import add_gui_item, ItemDetails
|
||||||
from .utils import send_event_notification, translate_string, load_user_details, get_default_filters
|
from .utils import send_event_notification, translate_string, load_user_details, get_default_filters
|
||||||
from .tracking import timer
|
from .tracking import timer
|
||||||
|
@ -15,12 +15,12 @@ import xbmcaddon
|
|||||||
import xbmc
|
import xbmc
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .utils import convert_size, translate_string, get_version, load_user_details, get_art_url, get_default_filters
|
from .utils import convert_size, translate_string, get_version, load_user_details, get_art_url, get_default_filters, translate_path
|
||||||
from .item_functions import get_art
|
from .item_functions import get_art
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
from .datamanager import clear_cached_server_data
|
from .datamanager import clear_cached_server_data
|
||||||
from .server_detect import check_server, check_connection_speed
|
from .server_detect import check_server, check_connection_speed
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .menu_functions import display_main_menu, display_menu, show_movie_alpha_list, show_tvshow_alpha_list, show_genre_list, show_search, show_movie_pages
|
from .menu_functions import display_main_menu, display_menu, show_movie_alpha_list, show_tvshow_alpha_list, show_genre_list, show_search, show_movie_pages
|
||||||
from .server_sessions import show_server_sessions
|
from .server_sessions import show_server_sessions
|
||||||
from .action_menu import ActionMenu
|
from .action_menu import ActionMenu
|
||||||
@ -34,9 +34,9 @@ from .skin_cloner import clone_default_skin
|
|||||||
from .play_utils import play_file
|
from .play_utils import play_file
|
||||||
|
|
||||||
__addon__ = xbmcaddon.Addon()
|
__addon__ = xbmcaddon.Addon()
|
||||||
__addondir__ = xbmc.translatePath(__addon__.getAddonInfo('profile'))
|
__addondir__ = translate_path(__addon__.getAddonInfo('profile'))
|
||||||
__cwd__ = __addon__.getAddonInfo('path')
|
__cwd__ = __addon__.getAddonInfo('path')
|
||||||
PLUGINPATH = xbmc.translatePath(os.path.join(__cwd__))
|
PLUGINPATH = translate_path(os.path.join(__cwd__))
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@ import requests
|
|||||||
import io
|
import io
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .item_functions import get_art
|
from .item_functions import get_art
|
||||||
|
from .utils import translate_path
|
||||||
|
|
||||||
pil_loaded = False
|
pil_loaded = False
|
||||||
try:
|
try:
|
||||||
@ -170,7 +171,7 @@ class HttpImageHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
image_path = xbmc.translatePath("special://home/addons/plugin.video.jellycon/icon.png").decode('utf-8')
|
image_path = translate_path("special://home/addons/plugin.video.jellycon/icon.png").decode('utf-8')
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type', 'image/png')
|
self.send_header('Content-type', 'image/png')
|
||||||
modified = xbmcvfs.Stat(image_path).st_mtime()
|
modified = xbmcvfs.Stat(image_path).st_mtime()
|
||||||
|
@ -7,20 +7,15 @@ from six.moves.urllib.parse import quote
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from .utils import datetime_from_string, get_art_url, image_url
|
from .utils import datetime_from_string, get_art_url, image_url
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from six import ensure_text
|
from six import ensure_text
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
|
||||||
|
|
||||||
addon_instance = xbmcaddon.Addon()
|
|
||||||
addon_path = addon_instance.getAddonInfo('path')
|
|
||||||
PLUGINPATH = xbmc.translatePath(os.path.join(addon_path))
|
|
||||||
|
|
||||||
|
|
||||||
class ItemDetails:
|
class ItemDetails:
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ from kodi_six.utils import py2_decode
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from .utils import get_device_id, get_version, load_user_details
|
from .utils import get_device_id, get_version, load_user_details
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import xbmcaddon
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
addon = xbmcaddon.Addon()
|
addon = xbmcaddon.Addon()
|
||||||
|
19
resources/lib/lazylogger.py
Normal file
19
resources/lib/lazylogger.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
|
|
||||||
|
class LazyLogger(object):
|
||||||
|
"""`helper.loghandler.getLogger()` is used everywhere.
|
||||||
|
This class helps avoiding import errors.
|
||||||
|
"""
|
||||||
|
__logger = None
|
||||||
|
__logger_name = None
|
||||||
|
|
||||||
|
def __init__(self, logger_name=None):
|
||||||
|
self.__logger_name = logger_name
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
if self.__logger is None:
|
||||||
|
from .loghandler import getLogger
|
||||||
|
self.__logger = getLogger(self.__logger_name)
|
||||||
|
return getattr(self.__logger, name)
|
@ -11,10 +11,12 @@ import traceback
|
|||||||
from six import ensure_text
|
from six import ensure_text
|
||||||
from kodi_six import xbmc, xbmcaddon
|
from kodi_six import xbmc, xbmcaddon
|
||||||
|
|
||||||
|
from .utils import translate_path
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
__addon__ = xbmcaddon.Addon(id='plugin.video.jellycon')
|
__addon__ = xbmcaddon.Addon(id='plugin.video.jellycon')
|
||||||
__pluginpath__ = xbmc.translatePath(__addon__.getAddonInfo('path'))
|
__pluginpath__ = translate_path(__addon__.getAddonInfo('path'))
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
@ -110,22 +112,6 @@ class MyFormatter(logging.Formatter):
|
|||||||
record.relpath = os.path.relpath(record.pathname, __pluginpath__)
|
record.relpath = os.path.relpath(record.pathname, __pluginpath__)
|
||||||
|
|
||||||
|
|
||||||
class LazyLogger(object):
|
|
||||||
"""`helper.loghandler.getLogger()` is used everywhere.
|
|
||||||
This class helps avoiding import errors.
|
|
||||||
"""
|
|
||||||
__logger = None
|
|
||||||
__logger_name = None
|
|
||||||
|
|
||||||
def __init__(self, logger_name=None):
|
|
||||||
self.__logger_name = logger_name
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
if self.__logger is None:
|
|
||||||
self.__logger = getLogger(self.__logger_name)
|
|
||||||
return getattr(self.__logger, name)
|
|
||||||
|
|
||||||
|
|
||||||
def get_filesystem_encoding():
|
def get_filesystem_encoding():
|
||||||
enc = sys.getfilesystemencoding()
|
enc = sys.getfilesystemencoding()
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import xbmcaddon
|
|||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .kodi_utils import add_menu_directory_item, HomeWindow
|
from .kodi_utils import add_menu_directory_item, HomeWindow
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .utils import get_jellyfin_url, translate_string, get_art_url, get_default_filters
|
from .utils import get_jellyfin_url, translate_string, get_art_url, get_default_filters
|
||||||
from .item_functions import get_art
|
from .item_functions import get_art
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import time
|
|||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
from .functions import show_menu
|
from .functions import show_menu
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .widgets import check_for_new_content
|
from .widgets import check_for_new_content
|
||||||
from .tracking import timer
|
from .tracking import timer
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||||||
|
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ import re
|
|||||||
from six.moves.urllib.parse import urlencode
|
from six.moves.urllib.parse import urlencode
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .dialogs import ResumeDialog
|
from .dialogs import ResumeDialog
|
||||||
from .utils import send_event_notification, convert_size, get_device_id, translate_string, load_user_details
|
from .utils import send_event_notification, convert_size, get_device_id, translate_string, load_user_details, translate_path
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
from .datamanager import clear_old_cache_data
|
from .datamanager import clear_old_cache_data
|
||||||
from .item_functions import extract_item_info, add_gui_item, get_art
|
from .item_functions import extract_item_info, add_gui_item, get_art
|
||||||
@ -280,7 +280,7 @@ def play_file(play_info):
|
|||||||
play_url = "%s/Items/%s/Images/Primary"
|
play_url = "%s/Items/%s/Images/Primary"
|
||||||
play_url = play_url % (server, item_id)
|
play_url = play_url % (server, item_id)
|
||||||
|
|
||||||
plugin_path = xbmc.translatePath(os.path.join(xbmcaddon.Addon().getAddonInfo('path')))
|
plugin_path = translate_path(os.path.join(xbmcaddon.Addon().getAddonInfo('path')))
|
||||||
action_menu = PictureViewer("PictureViewer.xml", plugin_path, "default", "720p")
|
action_menu = PictureViewer("PictureViewer.xml", plugin_path, "default", "720p")
|
||||||
action_menu.setPicture(play_url)
|
action_menu.setPicture(play_url)
|
||||||
action_menu.doModal()
|
action_menu.doModal()
|
||||||
@ -990,7 +990,7 @@ def prompt_for_stop_actions(item_id, data):
|
|||||||
if play_prompt:
|
if play_prompt:
|
||||||
|
|
||||||
plugin_path = settings.getAddonInfo('path')
|
plugin_path = settings.getAddonInfo('path')
|
||||||
plugin_path_real = xbmc.translatePath(os.path.join(plugin_path))
|
plugin_path_real = translate_path(os.path.join(plugin_path))
|
||||||
|
|
||||||
play_next_dialog = PlayNextDialog("PlayNextDialog.xml", plugin_path_real, "default", "720p")
|
play_next_dialog = PlayNextDialog("PlayNextDialog.xml", plugin_path_real, "default", "720p")
|
||||||
play_next_dialog.set_episode_info(next_episode)
|
play_next_dialog.set_episode_info(next_episode)
|
||||||
|
@ -6,8 +6,9 @@ import threading
|
|||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .dialogs import PlayNextDialog
|
from .dialogs import PlayNextDialog
|
||||||
|
from .utils import translate_path
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ class PlayNextService(threading.Thread):
|
|||||||
|
|
||||||
settings = xbmcaddon.Addon()
|
settings = xbmcaddon.Addon()
|
||||||
plugin_path = settings.getAddonInfo('path')
|
plugin_path = settings.getAddonInfo('path')
|
||||||
plugin_path_real = xbmc.translatePath(os.path.join(plugin_path))
|
plugin_path_real = translate_path(os.path.join(plugin_path))
|
||||||
|
|
||||||
play_next_dialog = PlayNextDialog("PlayNextDialog.xml", plugin_path_real, "default", "720p")
|
play_next_dialog = PlayNextDialog("PlayNextDialog.xml", plugin_path_real, "default", "720p")
|
||||||
play_next_dialog.set_episode_info(next_episode)
|
play_next_dialog.set_episode_info(next_episode)
|
||||||
|
@ -12,7 +12,7 @@ import xbmc
|
|||||||
|
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
from .jellyfin import API
|
from .jellyfin import API
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .utils import datetime_from_string, translate_string, save_user_details, load_user_details
|
from .utils import datetime_from_string, translate_string, save_user_details, load_user_details
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
@ -6,7 +6,7 @@ import xbmcplugin
|
|||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .item_functions import get_art
|
from .item_functions import get_art
|
||||||
from .utils import load_user_details
|
from .utils import load_user_details
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@ import xbmcgui
|
|||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
from .jsonrpc import JsonRpc, get_value, set_value
|
from .jsonrpc import JsonRpc, get_value, set_value
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
|
from .utils import translate_path
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
ver = xbmc.getInfoLabel('System.BuildVersion')[:2]
|
ver = xbmc.getInfoLabel('System.BuildVersion')[:2]
|
||||||
@ -49,7 +50,7 @@ def walk_path(root_path, relative_path, all_files):
|
|||||||
def clone_skin():
|
def clone_skin():
|
||||||
log.debug("Cloning Estuary Skin")
|
log.debug("Cloning Estuary Skin")
|
||||||
|
|
||||||
kodi_path = xbmc.translatePath("special://xbmc")
|
kodi_path = translate_path("special://xbmc")
|
||||||
kodi_skin_source = os.path.join(kodi_path, "addons", "skin.estuary")
|
kodi_skin_source = os.path.join(kodi_path, "addons", "skin.estuary")
|
||||||
log.debug("Kodi Skin Source: {0}".format(kodi_skin_source))
|
log.debug("Kodi Skin Source: {0}".format(kodi_skin_source))
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ def clone_skin():
|
|||||||
for found in all_files:
|
for found in all_files:
|
||||||
log.debug("Found Path: {0}".format(found))
|
log.debug("Found Path: {0}".format(found))
|
||||||
|
|
||||||
kodi_home_path = xbmc.translatePath("special://home")
|
kodi_home_path = translate_path("special://home")
|
||||||
kodi_skin_destination = os.path.join(kodi_home_path, "addons", "skin.estuary_jellycon")
|
kodi_skin_destination = os.path.join(kodi_home_path, "addons", "skin.estuary_jellycon")
|
||||||
log.debug("Kodi Skin Destination: {0}".format(kodi_skin_destination))
|
log.debug("Kodi Skin Destination: {0}".format(kodi_skin_destination))
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||||||
import sys
|
import sys
|
||||||
import functools
|
import functools
|
||||||
import time
|
import time
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
|
@ -7,13 +7,13 @@ import xbmc
|
|||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .utils import translate_string
|
from .utils import translate_string, translate_path
|
||||||
|
|
||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
details_string = 'EpisodeCount,SeasonCount,Path,Etag,MediaStreams'
|
details_string = 'EpisodeCount,SeasonCount,Path,Etag,MediaStreams'
|
||||||
icon = xbmc.translatePath('special://home/addons/plugin.video.jellycon/icon.png')
|
icon = translate_path('special://home/addons/plugin.video.jellycon/icon.png')
|
||||||
|
|
||||||
|
|
||||||
def not_found(content_string):
|
def not_found(content_string):
|
||||||
|
@ -5,6 +5,7 @@ import xbmcaddon
|
|||||||
import xbmc
|
import xbmc
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
from kodi_six.utils import py2_encode, py2_decode
|
from kodi_six.utils import py2_encode, py2_decode
|
||||||
|
import sys
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import string
|
import string
|
||||||
@ -20,7 +21,7 @@ from uuid import uuid4
|
|||||||
from six import ensure_text, ensure_binary, text_type
|
from six import ensure_text, ensure_binary, text_type
|
||||||
from six.moves.urllib.parse import urlencode
|
from six.moves.urllib.parse import urlencode
|
||||||
|
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
|
|
||||||
# hack to get datetime strptime loaded
|
# hack to get datetime strptime loaded
|
||||||
@ -29,6 +30,18 @@ throwaway = time.strptime('20110101', '%Y%m%d')
|
|||||||
log = LazyLogger(__name__)
|
log = LazyLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def kodi_version():
|
||||||
|
# Kodistubs returns empty string, causing Python 3 tests to choke on int()
|
||||||
|
# TODO: Make Kodistubs version configurable for testing purposes
|
||||||
|
if sys.version_info.major == 2:
|
||||||
|
default_versionstring = "18"
|
||||||
|
else:
|
||||||
|
default_versionstring = "19.1 (19.1.0) Git:20210509-85e05228b4"
|
||||||
|
|
||||||
|
version_string = xbmc.getInfoLabel('System.BuildVersion') or default_versionstring
|
||||||
|
return int(version_string.split(' ', 1)[0].split('.', 1)[0])
|
||||||
|
|
||||||
|
|
||||||
def get_jellyfin_url(path, params):
|
def get_jellyfin_url(path, params):
|
||||||
params["format"] = "json"
|
params["format"] = "json"
|
||||||
url_params = urlencode(params)
|
url_params = urlencode(params)
|
||||||
@ -118,7 +131,7 @@ def get_device_id():
|
|||||||
if client_id:
|
if client_id:
|
||||||
return '{}-{}'.format(client_id, hashed_name)
|
return '{}-{}'.format(client_id, hashed_name)
|
||||||
|
|
||||||
jellyfin_guid_path = py2_decode(xbmc.translatePath("special://temp/jellycon_guid"))
|
jellyfin_guid_path = py2_decode(translate_path("special://temp/jellycon_guid"))
|
||||||
log.debug("jellyfin_guid_path: {0}".format(jellyfin_guid_path))
|
log.debug("jellyfin_guid_path: {0}".format(jellyfin_guid_path))
|
||||||
guid = xbmcvfs.File(jellyfin_guid_path)
|
guid = xbmcvfs.File(jellyfin_guid_path)
|
||||||
client_id = guid.read()
|
client_id = guid.read()
|
||||||
@ -147,7 +160,7 @@ def get_version():
|
|||||||
def save_user_details(user_name, user_id, token):
|
def save_user_details(user_name, user_id, token):
|
||||||
settings = xbmcaddon.Addon()
|
settings = xbmcaddon.Addon()
|
||||||
save_user_to_settings = settings.getSetting('save_user_to_settings') == 'true'
|
save_user_to_settings = settings.getSetting('save_user_to_settings') == 'true'
|
||||||
addon_data = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
|
addon_data = translate_path(xbmcaddon.Addon().getAddonInfo('profile'))
|
||||||
|
|
||||||
# Save to a config file for reference later if desired
|
# Save to a config file for reference later if desired
|
||||||
if save_user_to_settings:
|
if save_user_to_settings:
|
||||||
@ -184,7 +197,7 @@ def load_user_details():
|
|||||||
user_name = settings.getSetting('username')
|
user_name = settings.getSetting('username')
|
||||||
#settings_user_name = settings.getSetting('username')
|
#settings_user_name = settings.getSetting('username')
|
||||||
save_user_to_settings = settings.getSetting('save_user_to_settings') == 'true'
|
save_user_to_settings = settings.getSetting('save_user_to_settings') == 'true'
|
||||||
addon_data = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile'))
|
addon_data = translate_path(xbmcaddon.Addon().getAddonInfo('profile'))
|
||||||
|
|
||||||
if save_user_to_settings:
|
if save_user_to_settings:
|
||||||
try:
|
try:
|
||||||
@ -315,3 +328,15 @@ def get_default_filters():
|
|||||||
filer_list.append("Overview")
|
filer_list.append("Overview")
|
||||||
|
|
||||||
return ','.join(filer_list)
|
return ','.join(filer_list)
|
||||||
|
|
||||||
|
|
||||||
|
def translate_path(path):
|
||||||
|
'''
|
||||||
|
Use new library location for translate path starting in Kodi 19
|
||||||
|
'''
|
||||||
|
version = kodi_version()
|
||||||
|
|
||||||
|
if version > 18:
|
||||||
|
return xbmcvfs.translatePath(path)
|
||||||
|
else:
|
||||||
|
return xbmc.translatePath(path)
|
||||||
|
@ -14,7 +14,7 @@ import xbmcgui
|
|||||||
|
|
||||||
from .jellyfin import API
|
from .jellyfin import API
|
||||||
from .functions import play_action
|
from .functions import play_action
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .jsonrpc import JsonRpc
|
from .jsonrpc import JsonRpc
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
from .utils import get_device_id, load_user_details
|
from .utils import get_device_id, load_user_details
|
||||||
|
@ -10,7 +10,7 @@ import time
|
|||||||
|
|
||||||
from .jellyfin import api
|
from .jellyfin import api
|
||||||
from .utils import get_jellyfin_url, image_url, load_user_details, get_art_url, get_default_filters
|
from .utils import get_jellyfin_url, image_url, load_user_details, get_art_url, get_default_filters
|
||||||
from .loghandler import LazyLogger
|
from .lazylogger import LazyLogger
|
||||||
from .kodi_utils import HomeWindow
|
from .kodi_utils import HomeWindow
|
||||||
from .dir_functions import process_directory
|
from .dir_functions import process_directory
|
||||||
from .tracking import timer
|
from .tracking import timer
|
||||||
|
@ -8,7 +8,7 @@ import xbmc
|
|||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
|
||||||
from resources.lib.loghandler import LazyLogger
|
from resources.lib.lazylogger import LazyLogger
|
||||||
from resources.lib.play_utils import Service, PlaybackService, send_progress
|
from resources.lib.play_utils import Service, PlaybackService, send_progress
|
||||||
from resources.lib.kodi_utils import HomeWindow
|
from resources.lib.kodi_utils import HomeWindow
|
||||||
from resources.lib.widgets import set_background_image, set_random_movies
|
from resources.lib.widgets import set_background_image, set_random_movies
|
||||||
|
Loading…
Reference in New Issue
Block a user