From 69064b457924b8fbdf19deedb7fb2f365d3f9e15 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 6 Jun 2015 01:06:33 -0500 Subject: [PATCH] Officially fix the os.path.exists By getting rid of it, and using xbmcvfs instead. Ha! --- resources/lib/PlayUtils.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/resources/lib/PlayUtils.py b/resources/lib/PlayUtils.py index 8339500d..a53d9cb9 100644 --- a/resources/lib/PlayUtils.py +++ b/resources/lib/PlayUtils.py @@ -5,10 +5,10 @@ import xbmc import xbmcgui import xbmcaddon +import xbmcvfs from ClientInformation import ClientInformation import Utils as utils -import os ########################################################################### @@ -314,21 +314,22 @@ class PlayUtils(): # File has no path in server return False - path = result[u'Path'] + # Convert Emby path to a path we can verify + path = self.directPlay(result) try: - pathexists = os.path.exists(path) - except UnicodeEncodeError: - pathexists = os.path.exists(path.encode('utf-8')) + pathexists = xbmcvfs.exists(path) + except: + pathexists = False + # Verify the device has access to the direct path if pathexists: # Local or Network path self.logMsg("Path exists.", 2) return True elif ":\\" not in path: - # Give benefit of the doubt for nfs protocol - # Does not behave with os.path.exists + # Give benefit of the doubt. self.logMsg("Can't verify path. Still try direct play.", 2) return True else: - self.logMsg("Path is detected as a Url: %s. Try direct streaming." % path, 2) + self.logMsg("Path is detected as follow: %s. Try direct streaming." % path, 2) return False \ No newline at end of file