From 04c74cb92d14f55080f50cb6314ef8a275186e46 Mon Sep 17 00:00:00 2001
From: angelblue05 <tamara.angel05@gmail.com>
Date: Sat, 27 Jan 2018 22:30:12 -0600
Subject: [PATCH] Force lowercase protocol for plugin playback

For direct path
---
 resources/lib/api.py       | 8 +++-----
 resources/lib/playutils.py | 5 +++++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/resources/lib/api.py b/resources/lib/api.py
index 3c8952b0..ddaa0975 100644
--- a/resources/lib/api.py
+++ b/resources/lib/api.py
@@ -390,12 +390,10 @@ class API(object):
                 filepath = filepath.replace("\\\\", "smb://")
                 filepath = filepath.replace("\\", "/")
 
-            if self.item.get('VideoType'):
-                videotype = self.item['VideoType']
-                # Specific format modification
-                if 'Dvd'in videotype:
+            if 'VideoType' in self.item:
+                if self.item['VideoType'] == "Dvd":
                     filepath = "%s/VIDEO_TS/VIDEO_TS.IFO" % filepath
-                elif 'BluRay' in videotype:
+                elif self.item['VideoType'] == "BluRay":
                     filepath = "%s/BDMV/index.bdmv" % filepath
 
             if "\\" in filepath:
diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py
index cab4124d..578de9c0 100644
--- a/resources/lib/playutils.py
+++ b/resources/lib/playutils.py
@@ -202,6 +202,11 @@ class PlayUtils():
             path = path.replace('\\\\', "smb://")
             path = path.replace('\\', "/")
 
+        if "://" in path:
+            # Protocol needs to be lowercase, otherwise weird things happen.
+            protocol = path.split('://')[0]
+            path = path.replace(protocol, protocol.lower())
+
         return path
 
     def get_http_path(self, source, transcode=False):