From 216159d96cd6798aecd1ae0f9f5c58f88b74bd01 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Thu, 11 May 2017 17:51:14 +0200 Subject: [PATCH] Change to xbmcvfs mkdirs --- resources/lib/PlexAPI.py | 4 ++-- resources/lib/entrypoint.py | 5 +++-- resources/lib/utils.py | 7 ++++--- resources/lib/videonodes.py | 7 ++++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 3dcc8696..ab96c6c4 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -40,10 +40,10 @@ from re import compile as re_compile, sub from json import dumps from urllib import urlencode, quote_plus, unquote from os.path import basename, join, exists -from os import makedirs import xbmcgui from xbmc import sleep, executebuiltin +from xbmcvfs import mkdirs import clientinfo as client from downloadutils import DownloadUtils @@ -2345,7 +2345,7 @@ class API(): Returns the path to the downloaded subtitle or None """ if not exists(v.EXTERNAL_SUBTITLE_TEMP_PATH): - makedirs(v.EXTERNAL_SUBTITLE_TEMP_PATH) + mkdirs(v.EXTERNAL_SUBTITLE_TEMP_PATH) path = join(v.EXTERNAL_SUBTITLE_TEMP_PATH, filename) r = DownloadUtils().downloadUrl(url, return_response=True) try: diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index fe56d842..dbac9e39 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -2,7 +2,7 @@ ############################################################################### import logging from shutil import copyfile -from os import walk, makedirs +from os import walk from os.path import basename, join, exists from sys import argv from urllib import urlencode @@ -10,6 +10,7 @@ from urllib import urlencode import xbmcplugin from xbmc import sleep, executebuiltin, translatePath from xbmcgui import ListItem +from xbmcvfs import mkdirs from utils import window, settings, language as lang, dialog, tryEncode, \ CatchExceptions, JSONRPC @@ -538,7 +539,7 @@ def getExtraFanArt(plexid, plexPath): fanartDir = translatePath("special://thumbnails/plex/%s/" % plexid) if not exists(fanartDir): # Download the images to the cache directory - makedirs(fanartDir) + mkdirs(fanartDir) xml = GetPlexMetadata(plexid) if xml is None: log.error('Could not download metadata for %s' % plexid) diff --git a/resources/lib/utils.py b/resources/lib/utils.py index d2a91f58..b040cdbd 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -13,14 +13,15 @@ from unicodedata import normalize import xml.etree.ElementTree as etree from functools import wraps from calendar import timegm -from os.path import exists, join -from os import remove, makedirs, walk +from os.path import join +from os import remove, walk from shutil import rmtree from urllib import quote_plus import xbmc import xbmcaddon import xbmcgui +from xbmcvfs import exists as kodi_exists, mkdirs from variables import DB_VIDEO_PATH, DB_MUSIC_PATH, DB_TEXTURE_PATH, \ DB_PLEX_PATH, KODI_PROFILE @@ -784,7 +785,7 @@ def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False): # Create the playlist directory if not exists(path): log.info("Creating directory: %s" % path) - makedirs(path) + mkdirs(path) # Only add the playlist if it doesn't already exists if exists(xsppath): diff --git a/resources/lib/videonodes.py b/resources/lib/videonodes.py index 4ffc91e7..1b200726 100644 --- a/resources/lib/videonodes.py +++ b/resources/lib/videonodes.py @@ -3,10 +3,11 @@ import logging from shutil import copytree import xml.etree.ElementTree as etree +from os import remove, listdir +from os.path import exists, isfile, join import xbmc -from os import remove, makedirs, listdir -from os.path import exists, isfile, join +from xbmcvfs import mkdirs from utils import window, settings, language as lang, tryEncode, indent, \ normalize_nodes @@ -84,7 +85,7 @@ class VideoNodes(object): if exists(nodepath) is False: # folder does not exist yet log.debug('Creating folder %s' % nodepath) - makedirs(nodepath) + mkdirs(nodepath) # Create index entry nodeXML = "%sindex.xml" % nodepath