mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Remove verify_kodi_defaults function
This commit is contained in:
parent
4b8f510325
commit
144f71e71f
2 changed files with 1 additions and 61 deletions
|
@ -17,7 +17,7 @@ import connect
|
||||||
import client
|
import client
|
||||||
import library
|
import library
|
||||||
import monitor
|
import monitor
|
||||||
from views import Views, verify_kodi_defaults
|
from views import Views
|
||||||
from helper import translate, window, settings, event, dialog, set_addon_mode
|
from helper import translate, window, settings, event, dialog, set_addon_mode
|
||||||
from helper.utils import JsonDebugPrinter
|
from helper.utils import JsonDebugPrinter
|
||||||
from jellyfin import Jellyfin
|
from jellyfin import Jellyfin
|
||||||
|
@ -67,8 +67,6 @@ class Service(xbmc.Monitor):
|
||||||
LOG.info("Using dynamic paths: %s", settings('useDirectPaths') == "0")
|
LOG.info("Using dynamic paths: %s", settings('useDirectPaths') == "0")
|
||||||
LOG.info("Log Level: %s", self.settings['log_level'])
|
LOG.info("Log Level: %s", self.settings['log_level'])
|
||||||
|
|
||||||
verify_kodi_defaults()
|
|
||||||
|
|
||||||
window('jellyfin.connected.bool', True)
|
window('jellyfin.connected.bool', True)
|
||||||
settings('groupedSets.bool', objects.utils.get_grouped_set())
|
settings('groupedSets.bool', objects.utils.get_grouped_set())
|
||||||
xbmc.Monitor.__init__(self)
|
xbmc.Monitor.__init__(self)
|
||||||
|
|
|
@ -103,64 +103,6 @@ DYNNODES = {
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
|
|
||||||
def verify_kodi_defaults():
|
|
||||||
''' Make sure we have the kodi default folder in place.
|
|
||||||
'''
|
|
||||||
|
|
||||||
source_base_path = xbmc.translatePath("special://xbmc/system/library/video")
|
|
||||||
dest_base_path = xbmc.translatePath("special://profile/library/video")
|
|
||||||
|
|
||||||
# Make sure the files exist in the local profile.
|
|
||||||
# TODO: Investigate why this is needed.
|
|
||||||
# I would think Kodi pulls data from the default profile
|
|
||||||
# if we don't do this.
|
|
||||||
for source_path, dirs, files in os.walk(source_base_path):
|
|
||||||
relative_path = os.path.relpath(source_path, source_base_path)
|
|
||||||
dest_path = os.path.join(dest_base_path, relative_path)
|
|
||||||
|
|
||||||
if not os.path.exists(dest_path):
|
|
||||||
os.mkdir(os.path.normpath(dest_path))
|
|
||||||
|
|
||||||
for file_name in files:
|
|
||||||
dest_file = os.path.join(dest_path, file_name)
|
|
||||||
copy = False
|
|
||||||
|
|
||||||
if not os.path.exists(dest_file):
|
|
||||||
copy = True
|
|
||||||
elif os.path.splitext(file_name)[1].lower() == '.xml':
|
|
||||||
try:
|
|
||||||
etree.parse(dest_file)
|
|
||||||
except etree.ParseError:
|
|
||||||
LOG.warning("Unable to parse `{}`, recovering from default.".format(dest_file))
|
|
||||||
copy = True
|
|
||||||
|
|
||||||
if copy:
|
|
||||||
source_file = os.path.join(source_path, file_name)
|
|
||||||
LOG.debug("Copying `{}` -> `{}`".format(source_file, dest_file))
|
|
||||||
xbmcvfs.copy(source_file, dest_file)
|
|
||||||
|
|
||||||
# This code seems to enforce a fixed ordering.
|
|
||||||
# Is it really desirable to force this on users?
|
|
||||||
# The default (system wide) order is [10, 20, 30] in Kodi 19.
|
|
||||||
for index, node in enumerate(['movies', 'tvshows', 'musicvideos']):
|
|
||||||
file_name = os.path.join(dest_base_path, node, "index.xml")
|
|
||||||
|
|
||||||
if xbmcvfs.exists(file_name):
|
|
||||||
try:
|
|
||||||
tree = etree.parse(file_name)
|
|
||||||
except etree.ParseError:
|
|
||||||
LOG.error("Unable to parse `{}`".format(file_name))
|
|
||||||
LOG.exception("We ensured the file was OK above, something is wrong!")
|
|
||||||
|
|
||||||
tree.getroot().set('order', str(17 + index))
|
|
||||||
tree.write(file_name)
|
|
||||||
|
|
||||||
playlist_path = xbmc.translatePath("special://profile/playlists/video")
|
|
||||||
|
|
||||||
if not xbmcvfs.exists(playlist_path):
|
|
||||||
xbmcvfs.mkdirs(playlist_path)
|
|
||||||
|
|
||||||
|
|
||||||
class Views(object):
|
class Views(object):
|
||||||
|
|
||||||
sync = None
|
sync = None
|
||||||
|
|
Loading…
Reference in a new issue