Fix Kodi checking for existing files and dirs
This commit is contained in:
parent
e41cf94cee
commit
61fb7694aa
2 changed files with 22 additions and 8 deletions
|
@ -2036,7 +2036,7 @@ class API():
|
||||||
listItem.addStreamInfo(
|
listItem.addStreamInfo(
|
||||||
"video", {'duration': self.getRuntime()[1]})
|
"video", {'duration': self.getRuntime()[1]})
|
||||||
|
|
||||||
def validatePlayurl(self, path, typus, forceCheck=False):
|
def validatePlayurl(self, path, typus, forceCheck=False, folder=False):
|
||||||
"""
|
"""
|
||||||
Returns a valid path for Kodi, e.g. with '\' substituted to '\\' in
|
Returns a valid path for Kodi, e.g. with '\' substituted to '\\' in
|
||||||
Unicode. Returns None if this is not possible
|
Unicode. Returns None if this is not possible
|
||||||
|
@ -2045,6 +2045,7 @@ class API():
|
||||||
typus : Plex type from PMS xml
|
typus : Plex type from PMS xml
|
||||||
forceCheck : Will always try to check validity of path
|
forceCheck : Will always try to check validity of path
|
||||||
Will also skip confirmation dialog if path not found
|
Will also skip confirmation dialog if path not found
|
||||||
|
folder : Set to True if path is a folder
|
||||||
"""
|
"""
|
||||||
if path is None:
|
if path is None:
|
||||||
return None
|
return None
|
||||||
|
@ -2070,12 +2071,23 @@ class API():
|
||||||
if utils.window('emby_pathverified') == 'true' and forceCheck is False:
|
if utils.window('emby_pathverified') == 'true' and forceCheck is False:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
check = xbmcvfs.exists(path.encode('utf-8'))
|
# exist() needs a / or \ at the end to work for directories
|
||||||
# exists() NEEDS either a '/' or '\\' at the end of a DIR name
|
if folder is False:
|
||||||
if check is False:
|
# files
|
||||||
check = xbmcvfs.exists((path + '/').encode('utf-8'))
|
check = True if xbmcvfs.exists(path.encode('utf-8')) == 1 \
|
||||||
if check is False:
|
else False
|
||||||
check = xbmcvfs.exists((path + '\\').encode('utf-8'))
|
else:
|
||||||
|
# directories
|
||||||
|
if "\\" in path:
|
||||||
|
# Add the missing backslash
|
||||||
|
check = True if \
|
||||||
|
xbmcvfs.exists((path + "\\").encode('utf-8')) == 1 \
|
||||||
|
else False
|
||||||
|
else:
|
||||||
|
check = True if \
|
||||||
|
xbmcvfs.exists((path + "/").encode('utf-8')) == 1 \
|
||||||
|
else False
|
||||||
|
|
||||||
if check is False:
|
if check is False:
|
||||||
if forceCheck is False:
|
if forceCheck is False:
|
||||||
# Validate the path is correct with user intervention
|
# Validate the path is correct with user intervention
|
||||||
|
|
|
@ -1022,7 +1022,9 @@ class TVShows(Items):
|
||||||
# Something went wrong, trying to use non-direct paths
|
# Something went wrong, trying to use non-direct paths
|
||||||
doIndirect = True
|
doIndirect = True
|
||||||
else:
|
else:
|
||||||
playurl = API.validatePlayurl(playurl, API.getType())
|
playurl = API.validatePlayurl(playurl,
|
||||||
|
API.getType(),
|
||||||
|
folder=True)
|
||||||
if playurl is None:
|
if playurl is None:
|
||||||
return False
|
return False
|
||||||
if "\\" in playurl:
|
if "\\" in playurl:
|
||||||
|
|
Loading…
Reference in a new issue