Tweaking audio subs pref some more
This commit is contained in:
parent
ad6626c086
commit
3fcdbe0bb8
1 changed files with 75 additions and 67 deletions
|
@ -249,23 +249,31 @@ class Player( xbmc.Player ):
|
||||||
defaultsubs = WINDOW.getProperty("%ssubs" % currentFile)
|
defaultsubs = WINDOW.getProperty("%ssubs" % currentFile)
|
||||||
|
|
||||||
codecs = [
|
codecs = [
|
||||||
# To be adjusted and include every codec Emby server can return.
|
# Possible codecs
|
||||||
'und','Stereo','Stereo - Stereo','AC3 5.1'
|
'und','Stereo','AC3','DTS', '5.1',
|
||||||
|
#'Stereo - Stereo','AC3 5.1', 'DTS 5.1', 'DTS-HD MA 5.1'
|
||||||
]
|
]
|
||||||
|
|
||||||
if len(audiotracks) == 1 and len(subs) == 0:
|
if len(audiotracks) == 1 and len(subs) == 0:
|
||||||
# There's only one audio track and no subtitles
|
# There's only one audio track and no subtitles
|
||||||
xbmcplayer.showSubtitles(False)
|
xbmcplayer.showSubtitles(False)
|
||||||
|
|
||||||
elif self.audioPref in audiotracks:
|
else:
|
||||||
self.logMsg("Door 1", 2)
|
# More complex cases
|
||||||
|
codec_intrack = False
|
||||||
|
for codec in codecs:
|
||||||
|
if codec in '\n'.join(audiotracks):
|
||||||
|
codec_intrack = True
|
||||||
|
|
||||||
|
if self.audioPref in audiotracks:
|
||||||
|
self.logMsg("Door 1", 1)
|
||||||
# Audio pref is available
|
# Audio pref is available
|
||||||
index = audiotracks.index(self.audioPref)
|
index = audiotracks.index(self.audioPref)
|
||||||
xbmcplayer.setAudioStream(index)
|
xbmcplayer.setAudioStream(index)
|
||||||
|
|
||||||
if addon.getSetting('subsoverride') == "true":
|
if addon.getSetting('subsoverride') == "true":
|
||||||
if self.subsPref in subs:
|
if self.subsPref in subs:
|
||||||
self.logMsg("Door 1.1", 2)
|
self.logMsg("Door 1.1", 1)
|
||||||
# Subs are forced.
|
# Subs are forced.
|
||||||
index = subs.index(self.subsPref)
|
index = subs.index(self.subsPref)
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
|
@ -273,23 +281,23 @@ class Player( xbmc.Player ):
|
||||||
# Use default subs
|
# Use default subs
|
||||||
if defaultsubs == "ssa":
|
if defaultsubs == "ssa":
|
||||||
# For some reason, Kodi sees SSA as ''
|
# For some reason, Kodi sees SSA as ''
|
||||||
self.logMsg("Door 1.2", 2)
|
self.logMsg("Door 1.2", 1)
|
||||||
index = subs.index('')
|
index = subs.index('')
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
elif defaultsubs:
|
elif defaultsubs:
|
||||||
self.logMsg("Door 1.3", 2)
|
self.logMsg("Door 1.3", 1)
|
||||||
index = subs.index(defaultsubs)
|
index = subs.index(defaultsubs)
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
else:
|
else:
|
||||||
xbmcplayer.showSubtitles(False)
|
xbmcplayer.showSubtitles(False)
|
||||||
|
|
||||||
elif len(audiotracks) == 1 and '\n'.join(audiotracks) not in codecs:
|
elif (len(audiotracks) == 1) and not codec_intrack:
|
||||||
self.logMsg("Door 2", 2)
|
self.logMsg("Door 2", 1)
|
||||||
# 1. There's one audio track.
|
# 1. There's one audio track.
|
||||||
# 2. The audio is defined as a language.
|
# 2. The audio is defined as a language.
|
||||||
# 3. Audio pref is not available, guaranteed.
|
# 3. Audio pref is not available, guaranteed.
|
||||||
if self.subsPref in subs:
|
if self.subsPref in subs:
|
||||||
self.logMsg("Door 2.1", 2)
|
self.logMsg("Door 2.1", 1)
|
||||||
# Subs pref is available.
|
# Subs pref is available.
|
||||||
index = subs.index(self.subsPref)
|
index = subs.index(self.subsPref)
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
|
@ -297,25 +305,25 @@ class Player( xbmc.Player ):
|
||||||
# Use default subs
|
# Use default subs
|
||||||
if defaultsubs == "ssa":
|
if defaultsubs == "ssa":
|
||||||
# For some reason, Kodi sees SSA as ''
|
# For some reason, Kodi sees SSA as ''
|
||||||
self.logMsg("Door 2.2", 2)
|
self.logMsg("Door 2.2", 1)
|
||||||
index = subs.index('')
|
index = subs.index('')
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
elif defaultsubs:
|
elif defaultsubs:
|
||||||
self.logMsg("Door 2.3", 2)
|
self.logMsg("Door 2.3", 1)
|
||||||
index = subs.index(defaultsubs)
|
index = subs.index(defaultsubs)
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
|
|
||||||
elif len(audiotracks) == 1 and '\n'.join(audiotracks) in codecs:
|
elif len(audiotracks) == 1 and codec_intrack:
|
||||||
self.logMsg("Door 3", 2)
|
self.logMsg("Door 3", 1)
|
||||||
# 1. There one audio track.
|
# 1. There one audio track.
|
||||||
# 2. The audio is undefined or a codec.
|
# 2. The audio is undefined or a codec.
|
||||||
# 3. Audio track is be mislabeled.
|
# 3. Audio track is mislabeled.
|
||||||
if self.subsPref in subs:
|
if self.subsPref in subs:
|
||||||
# If the subtitle is available, only display
|
# If the subtitle is available, only display
|
||||||
# if the setting is enabled.
|
# if the setting is enabled.
|
||||||
if addon.getSetting('subsoverride') == "true":
|
if addon.getSetting('subsoverride') == "true":
|
||||||
# Subs are forced.
|
# Subs are forced.
|
||||||
self.logMsg("Door 3.2", 2)
|
self.logMsg("Door 3.2", 1)
|
||||||
index = subs.index(self.subsPref)
|
index = subs.index(self.subsPref)
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
else:
|
else:
|
||||||
|
@ -326,16 +334,16 @@ class Player( xbmc.Player ):
|
||||||
# Use default subs
|
# Use default subs
|
||||||
if defaultsubs == "ssa":
|
if defaultsubs == "ssa":
|
||||||
# For some reason, Kodi sees SSA as ''
|
# For some reason, Kodi sees SSA as ''
|
||||||
self.logMsg("Door 3.4", 2)
|
self.logMsg("Door 3.4", 1)
|
||||||
index = subs.index('')
|
index = subs.index('')
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
elif defaultsubs:
|
elif defaultsubs:
|
||||||
self.logMsg("Door 3.5", 2)
|
self.logMsg("Door 3.5", 1)
|
||||||
index = subs.index(defaultsubs)
|
index = subs.index(defaultsubs)
|
||||||
xbmcplayer.setSubtitleStream(index)
|
xbmcplayer.setSubtitleStream(index)
|
||||||
else:
|
else:
|
||||||
# Nothing matches, let the user decide.
|
# Nothing matches, let the user decide.
|
||||||
self.logMsg("Door 3.6", 2)
|
self.logMsg("Door 3.6", 1)
|
||||||
xbmcplayer.showSubtitles(False)
|
xbmcplayer.showSubtitles(False)
|
||||||
|
|
||||||
# we may need to wait until the info is available
|
# we may need to wait until the info is available
|
||||||
|
|
Loading…
Reference in a new issue