diff --git a/context.py b/context.py index 88eea1b3..c05f71df 100644 --- a/context.py +++ b/context.py @@ -6,12 +6,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera import os import sys -from kodi_six import xbmc, xbmcaddon +from kodi_six import xbmcaddon, xbmcvfs ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) +__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) sys.path.insert(0, __base__) diff --git a/context_play.py b/context_play.py index 87d1638d..193c2934 100644 --- a/context_play.py +++ b/context_play.py @@ -6,12 +6,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera import os import sys -from kodi_six import xbmc, xbmcaddon +from kodi_six import xbmcaddon, xbmcvfs ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) +__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) sys.path.insert(0, __base__) diff --git a/default.py b/default.py index 998ff512..8362df5a 100644 --- a/default.py +++ b/default.py @@ -6,12 +6,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera import os import sys -from kodi_six import xbmc, xbmcaddon +from kodi_six import xbmcaddon, xbmcvfs ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) +__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) sys.path.insert(0, __base__) diff --git a/jellyfin_kodi/client.py b/jellyfin_kodi/client.py index 76ea74b4..77ccd5cd 100644 --- a/jellyfin_kodi/client.py +++ b/jellyfin_kodi/client.py @@ -85,7 +85,7 @@ def get_device_id(reset=False): if client_id: return client_id - directory = xbmc.translatePath('special://profile/addon_data/plugin.video.jellyfin/') + directory = xbmcvfs.translatePath('special://profile/addon_data/plugin.video.jellyfin/') if not xbmcvfs.exists(directory): xbmcvfs.mkdir(directory) diff --git a/jellyfin_kodi/database/__init__.py b/jellyfin_kodi/database/__init__.py index be1d6cbc..66c6d720 100644 --- a/jellyfin_kodi/database/__init__.py +++ b/jellyfin_kodi/database/__init__.py @@ -21,7 +21,7 @@ from helper import LazyLogger LOG = LazyLogger(__name__) -ADDON_DATA = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/") +ADDON_DATA = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/") ################################################################################################# @@ -77,7 +77,7 @@ class Database(object): def _get_database(self, path, silent=False): - path = xbmc.translatePath(path) + path = xbmcvfs.translatePath(path) if not silent: @@ -105,7 +105,7 @@ class Database(object): xbmc.executebuiltin('UpdateLibrary(video)') xbmc.sleep(200) - databases = xbmc.translatePath("special://database/") + databases = xbmcvfs.translatePath("special://database/") types = { 'video': "MyVideos", 'music': "MyMusic", @@ -131,7 +131,7 @@ class Database(object): LOG.debug("Discovered database: %s", target) self.discovered_file = target['db_file'] - return xbmc.translatePath("special://database/%s" % target['db_file']) + return xbmcvfs.translatePath("special://database/%s" % target['db_file']) def _sql(self, db_file): @@ -293,7 +293,7 @@ def reset_artwork(): ''' Remove all existing texture. ''' - thumbnails = xbmc.translatePath('special://thumbnails/') + thumbnails = xbmcvfs.translatePath('special://thumbnails/') if xbmcvfs.exists(thumbnails): dirs, ignore = xbmcvfs.listdir(thumbnails) diff --git a/jellyfin_kodi/entrypoint/context.py b/jellyfin_kodi/entrypoint/context.py index 2c5703ab..5cc625a7 100644 --- a/jellyfin_kodi/entrypoint/context.py +++ b/jellyfin_kodi/entrypoint/context.py @@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera import json import sys -from kodi_six import xbmc, xbmcaddon +from kodi_six import xbmc, xbmcaddon, xbmcvfs import database from dialogs import context @@ -52,7 +52,7 @@ class Context(object): self.media = xbmc.getInfoLabel('ListItem.DBTYPE') item_id = None - addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") + addon_data = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") with open(addon_data, 'rb') as infile: data = json.load(infile) diff --git a/jellyfin_kodi/entrypoint/default.py b/jellyfin_kodi/entrypoint/default.py index cbede539..83ea81e8 100644 --- a/jellyfin_kodi/entrypoint/default.py +++ b/jellyfin_kodi/entrypoint/default.py @@ -57,7 +57,7 @@ class Events(object): jellyfin_client = Jellyfin(server).get_client() api_client = jellyfin_client.jellyfin - addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") + addon_data = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") try: with open(addon_data, 'rb') as infile: data = json.load(infile) @@ -519,7 +519,7 @@ def get_fanart(item_id, path, server_id=None, api_client=None): LOG.info("[ extra fanart ] %s", item_id) objects = Objects() list_li = [] - directory = xbmc.translatePath("special://thumbnails/jellyfin/%s/" % item_id) + directory = xbmcvfs.translatePath("special://thumbnails/jellyfin/%s/" % item_id) if not xbmcvfs.exists(directory): @@ -792,7 +792,7 @@ def get_themes(api_client): from helper.playutils import PlayUtils from helper.xmls import tvtunes_nfo - library = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/library") + library = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/library") play = settings('useDirectPaths') == "1" if not xbmcvfs.exists(library + '/'): @@ -886,7 +886,7 @@ def backup(): delete_folder(backup) - addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin") + addon_data = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin") destination_data = os.path.join(backup, "addon_data", "plugin.video.jellyfin") destination_databases = os.path.join(backup, "Database") @@ -901,18 +901,18 @@ def backup(): databases = Objects().objects - db = xbmc.translatePath(databases['jellyfin']) + db = xbmcvfs.translatePath(databases['jellyfin']) xbmcvfs.copy(db, os.path.join(destination_databases, db.rsplit('\\', 1)[1])) LOG.info("copied jellyfin.db") - db = xbmc.translatePath(databases['video']) + db = xbmcvfs.translatePath(databases['video']) filename = db.rsplit('\\', 1)[1] xbmcvfs.copy(db, os.path.join(destination_databases, filename)) LOG.info("copied %s", filename) if settings('enableMusic.bool'): - db = xbmc.translatePath(databases['music']) + db = xbmcvfs.translatePath(databases['music']) filename = db.rsplit('\\', 1)[1] xbmcvfs.copy(db, os.path.join(destination_databases, filename)) LOG.info("copied %s", filename) diff --git a/jellyfin_kodi/entrypoint/service.py b/jellyfin_kodi/entrypoint/service.py index 04cc4161..e86b9094 100644 --- a/jellyfin_kodi/entrypoint/service.py +++ b/jellyfin_kodi/entrypoint/service.py @@ -9,7 +9,7 @@ from datetime import datetime # Workaround for threads using datetime: _striptime is locked import _strptime # noqa:F401 -from kodi_six import xbmc, xbmcgui +from kodi_six import xbmc, xbmcgui, xbmcvfs from six.moves import reload_module as reload import objects @@ -44,7 +44,7 @@ class Service(xbmc.Monitor): window('jellyfin_should_stop', clear=True) self.settings['addon_version'] = client.get_version() - self.settings['profile'] = xbmc.translatePath('special://profile') + self.settings['profile'] = xbmcvfs.translatePath('special://profile') self.settings['mode'] = settings('useDirectPaths') self.settings['log_level'] = settings('logLevel') or "1" self.settings['auth_check'] = True diff --git a/jellyfin_kodi/helper/loghandler.py b/jellyfin_kodi/helper/loghandler.py index f8341102..87aa5b8c 100644 --- a/jellyfin_kodi/helper/loghandler.py +++ b/jellyfin_kodi/helper/loghandler.py @@ -8,7 +8,7 @@ import logging import traceback from six import ensure_text -from kodi_six import xbmc, xbmcaddon +from kodi_six import xbmc, xbmcaddon, xbmcvfs import database from helper import get_filesystem_encoding @@ -19,7 +19,7 @@ from . import kodi_version ################################################################################################## __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__pluginpath__ = xbmc.translatePath(__addon__.getAddonInfo('path')) +__pluginpath__ = xbmcvfs.translatePath(__addon__.getAddonInfo('path')) ################################################################################################## diff --git a/jellyfin_kodi/helper/playutils.py b/jellyfin_kodi/helper/playutils.py index 8200604a..62789577 100644 --- a/jellyfin_kodi/helper/playutils.py +++ b/jellyfin_kodi/helper/playutils.py @@ -548,7 +548,7 @@ class PlayUtils(object): ''' Download external subtitles to temp folder to be able to have proper names to streams. ''' - temp = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/temp/") + temp = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/temp/") if not xbmcvfs.exists(temp): xbmcvfs.mkdir(temp) diff --git a/jellyfin_kodi/helper/xmls.py b/jellyfin_kodi/helper/xmls.py index 921865bf..8caa42de 100644 --- a/jellyfin_kodi/helper/xmls.py +++ b/jellyfin_kodi/helper/xmls.py @@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera import os import xml.etree.ElementTree as etree -from kodi_six import xbmc +from kodi_six import xbmc, xbmcvfs from helper import LazyLogger @@ -47,7 +47,7 @@ def advanced_settings(): if settings('useDirectPaths') != "0": return - path = xbmc.translatePath("special://profile/") + path = xbmcvfs.translatePath("special://profile/") file = os.path.join(path, 'advancedsettings.xml') try: diff --git a/jellyfin_kodi/objects/actions.py b/jellyfin_kodi/objects/actions.py index 4ebfb671..0785f2e9 100644 --- a/jellyfin_kodi/objects/actions.py +++ b/jellyfin_kodi/objects/actions.py @@ -8,7 +8,7 @@ import sys import json from datetime import timedelta -from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon +from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon, xbmcvfs import database from helper import translate, playutils, api, window, settings, dialog @@ -34,7 +34,7 @@ class Actions(object): LOG.debug('No api client provided, attempting to use config file') jellyfin_client = Jellyfin(server_id).get_client() api_client = jellyfin_client.jellyfin - addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") + addon_data = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/data.json") try: with open(addon_data, 'rb') as infile: data = json.load(infile) diff --git a/jellyfin_kodi/player.py b/jellyfin_kodi/player.py index e7121452..d652ca2d 100644 --- a/jellyfin_kodi/player.py +++ b/jellyfin_kodi/player.py @@ -420,7 +420,7 @@ class Player(xbmc.Player): LOG.info("<[ transcode/%s ]", item['Id']) item['Server'].jellyfin.close_transcode(item['DeviceId']) - path = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/temp/") + path = xbmcvfs.translatePath("special://profile/addon_data/plugin.video.jellyfin/temp/") if xbmcvfs.exists(path): dirs, files = xbmcvfs.listdir(path) diff --git a/jellyfin_kodi/views.py b/jellyfin_kodi/views.py index aa07aca7..526dce98 100644 --- a/jellyfin_kodi/views.py +++ b/jellyfin_kodi/views.py @@ -186,8 +186,8 @@ class Views(object): ''' Set up playlists, video nodes, window prop. ''' - node_path = xbmc.translatePath("special://profile/library/video") - playlist_path = xbmc.translatePath("special://profile/playlists/video") + node_path = xbmcvfs.translatePath("special://profile/library/video") + playlist_path = xbmcvfs.translatePath("special://profile/playlists/video") index = 0 # Kodi 19 doesn't seem to create this directory on it's own @@ -931,7 +931,7 @@ class Views(object): ''' Remove all jellyfin playlists. ''' - path = xbmc.translatePath("special://profile/playlists/video/") + path = xbmcvfs.translatePath("special://profile/playlists/video/") _, files = xbmcvfs.listdir(path) for file in files: if file.startswith('jellyfin'): @@ -941,7 +941,7 @@ class Views(object): ''' Remove playlist based based on view_id. ''' - path = xbmc.translatePath("special://profile/playlists/video/") + path = xbmcvfs.translatePath("special://profile/playlists/video/") _, files = xbmcvfs.listdir(path) for file in files: file = file @@ -958,7 +958,7 @@ class Views(object): ''' Remove node and children files. ''' - path = xbmc.translatePath("special://profile/library/video/") + path = xbmcvfs.translatePath("special://profile/library/video/") dirs, files = xbmcvfs.listdir(path) for file in files: @@ -980,7 +980,7 @@ class Views(object): ''' Remove node and children files based on view_id. ''' - path = xbmc.translatePath("special://profile/library/video/") + path = xbmcvfs.translatePath("special://profile/library/video/") dirs, files = xbmcvfs.listdir(path) for directory in dirs: diff --git a/service.py b/service.py index 4d0fb7b7..ffa052fc 100644 --- a/service.py +++ b/service.py @@ -7,12 +7,12 @@ import os import threading import sys -from kodi_six import xbmc, xbmcaddon +from kodi_six import xbmc, xbmcaddon, xbmcvfs ################################################################################################# __addon__ = xbmcaddon.Addon(id='plugin.video.jellyfin') -__base__ = xbmc.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) +__base__ = xbmcvfs.translatePath(os.path.join(__addon__.getAddonInfo('path'), 'jellyfin_kodi')) sys.path.insert(0, __base__)