diff --git a/addon.xml b/addon.xml index af031f53..44e3d141 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/connect/credentials.py b/resources/lib/connect/credentials.py index 31107179..f7f9fa36 100644 --- a/resources/lib/connect/credentials.py +++ b/resources/lib/connect/credentials.py @@ -27,7 +27,7 @@ class Credentials(object): def setPath(self, path): # Path to save persistant data.txt - self.path = path.encode('utf-8') + self.path = path def _ensure(self): diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index a915b18c..ba451ba9 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -138,14 +138,13 @@ class PlayUtils(): # User forcing to play via HTTP log.info("Can't direct play, play from HTTP enabled.") return False - - vid = self.getVideoStreamID() - videotrack = self.item['MediaStreams'][vid]['DisplayTitle'] + + videotrack = self.item['MediaSources'][0]['Name'] transcodeH265 = settings('transcodeH265') - videoprofile = self.item['MediaStreams'][vid]['Profile'] + videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x] transcodeHi10P = settings('transcodeHi10P') - if transcodeHi10P == "true" and ("Main 10" in videoprofile or "High 10" in videoprofile) and ("H264" in videotrack or "H265" in videotrack or "HEVC" in videotrack): + if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles: return False if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack): @@ -242,14 +241,13 @@ class PlayUtils(): return False def isDirectStream(self): - - vid = self.getVideoStreamID() - videotrack = self.item['MediaStreams'][vid]['DisplayTitle'] + + videotrack = self.item['MediaSources'][0]['Name'] transcodeH265 = settings('transcodeH265') - videoprofile = self.item['MediaStreams'][vid]['Profile'] + videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x] transcodeHi10P = settings('transcodeHi10P') - if transcodeHi10P == "true" and ("Main 10" in videoprofile or "High 10" in videoprofile) and ("H264" in videotrack or "H265" in videotrack or "HEVC" in videotrack): + if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles: return False if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack): @@ -707,7 +705,3 @@ class PlayUtils(): log.debug(self.item) return False - def getVideoStreamID(self): - # Sometimes video stream is not 0, this locates it. - videx = [x['Index'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Video' in x['Type']] - return videx[0]