Improve transcoding detection (#107)

* Update Leia Video DB

* Fix transcoding for non-standard filenames

Fix transcoding for cases where the filename does not contain codec
Added HEVC to 10bit transcode option
Added case for non-default video track ids
This commit is contained in:
simpman 2017-12-07 01:03:31 -07:00 committed by angelblue05
parent 634090e93c
commit a7057ec3dc
2 changed files with 16 additions and 10 deletions

View file

@ -30,7 +30,7 @@ def video_database():
'15': 93, # Isengard '15': 93, # Isengard
'16': 99, # Jarvis '16': 99, # Jarvis
'17': 107,# Krypton '17': 107,# Krypton
'18': 108 # Leia '18': 109 # Leia
} }
return xbmc.translatePath("special://database/MyVideos%s.db" return xbmc.translatePath("special://database/MyVideos%s.db"
% db_version.get(KODI, "")).decode('utf-8') % db_version.get(KODI, "")).decode('utf-8')
@ -244,4 +244,4 @@ def db_reset():
except: except:
pass pass

View file

@ -138,13 +138,14 @@ class PlayUtils():
# User forcing to play via HTTP # User forcing to play via HTTP
log.info("Can't direct play, play from HTTP enabled.") log.info("Can't direct play, play from HTTP enabled.")
return False return False
videotrack = self.item['MediaSources'][0]['Name'] vid = self.getVideoStreamID()
videotrack = self.item['MediaStreams'][vid]['DisplayTitle']
transcodeH265 = settings('transcodeH265') transcodeH265 = settings('transcodeH265')
videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x] videoprofile = self.item['MediaStreams'][vid]['Profile']
transcodeHi10P = settings('transcodeHi10P') transcodeHi10P = settings('transcodeHi10P')
if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles: 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):
return False return False
if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack): if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack):
@ -241,13 +242,14 @@ class PlayUtils():
return False return False
def isDirectStream(self): def isDirectStream(self):
videotrack = self.item['MediaSources'][0]['Name'] vid = self.getVideoStreamID()
videotrack = self.item['MediaStreams'][vid]['DisplayTitle']
transcodeH265 = settings('transcodeH265') transcodeH265 = settings('transcodeH265')
videoprofiles = [x['Profile'] for x in self.item['MediaSources'][0]['MediaStreams'] if 'Profile' in x] videoprofile = self.item['MediaStreams'][vid]['Profile']
transcodeHi10P = settings('transcodeHi10P') transcodeHi10P = settings('transcodeHi10P')
if transcodeHi10P == "true" and "H264" in videotrack and "High 10" in videoprofiles: 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):
return False return False
if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack): if transcodeH265 in ("1", "2", "3") and ("HEVC" in videotrack or "H265" in videotrack):
@ -703,3 +705,7 @@ class PlayUtils():
except KeyError as error: except KeyError as error:
return False 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]