Update labels for settings + modify h265 transcode

This convert the setting into convert H265 for resolution and higher
(for example: 480p and higher)
Also prepare for string translation
This commit is contained in:
angelblue05 2016-02-03 23:08:00 -06:00
parent c4608b38e1
commit 452df0614d
3 changed files with 122 additions and 78 deletions

View file

@ -97,17 +97,22 @@ class PlayUtils():
self.logMsg("Can't direct play, play from HTTP enabled.", 1)
return False
if (utils.settings('transcodeH265') == "true" and
item['MediaSources'][0]['Name'].startswith(("1080P/HEVC","1080P/H265"))):
# Avoid H265 1080p
self.logMsg("Option to transcode 1080P/H265 enabled.", 1)
return False
videotrack = item['MediaSources'][0]['Name']
transcodeH265 = utils.settings('transcodeH265')
elif (utils.settings('transcode720H265') == "true" and
item['MediaSources'][0]['Name'].startswith(("720P/HEVC","720P/H265"))):
# Avoid H265 720p
self.logMsg("Option to transcode 720P/H265 enabled.", 1)
return False
if transcodeH265 != "0" and ("HEVC" in videotrack or "H265" in videotrack):
# Avoid H265/HEVC depending on the resolution
resolution = int(videotrack.split("P", 1)[0])
res = {
'1': 480,
'2': 720,
'3': 1080
}
self.logMsg("Resolution is: %sP, transcode for resolution: %sP+"
% (resolution, res[transcodeH265]), 1)
if res[transcodeH265] <= resolution:
return False
canDirectPlay = item['MediaSources'][0]['SupportsDirectPlay']
# Make sure direct play is supported by the server
@ -203,17 +208,22 @@ class PlayUtils():
item = self.item
if (utils.settings('transcodeH265') == "true" and
item['MediaSources'][0]['Name'].startswith(("1080P/HEVC","1080P/H265"))):
# Avoid H265 1080p
self.logMsg("Option to transcode 1080P/H265 enabled.", 1)
return False
videotrack = item['MediaSources'][0]['Name']
transcodeH265 = utils.settings('transcodeH265')
elif (utils.settings('transcode720H265') == "true" and
item['MediaSources'][0]['Name'].startswith(("720P/HEVC","720P/H265"))):
# Avoid H265 720p
self.logMsg("Option to transcode 720P/H265 enabled.", 1)
return False
if transcodeH265 != "0" and ("HEVC" in videotrack or "H265" in videotrack):
# Avoid H265/HEVC depending on the resolution
resolution = int(videotrack.split("P", 1)[0])
res = {
'1': 480,
'2': 720,
'3': 1080
}
self.logMsg("Resolution is: %sP, transcode for resolution: %sP+"
% (resolution, res[transcodeH265]), 1)
if res[transcodeH265] <= resolution:
return False
# Requirement: BitRate, supported encoding
canDirectStream = item['MediaSources'][0]['SupportsDirectStream']