New setting to use Plex default subtitles
This commit is contained in:
parent
143fd2212d
commit
f2f68f4532
4 changed files with 25 additions and 19 deletions
|
@ -422,6 +422,7 @@
|
|||
<string id="39072">Is your Kodi installed on a low-powered device like a Raspberry Pi? If yes, then we will reduce the strain on Kodi to prevent it from crashing.</string>
|
||||
<string id="39073">Appearance Tweaks</string>
|
||||
<string id="39074">TV Shows</string>
|
||||
<string id="39075">Always use default Plex subtitle if possible</string>
|
||||
|
||||
<!-- Plex Entrypoint.py -->
|
||||
<string id="39200">Log-out Plex Home User </string>
|
||||
|
|
|
@ -360,6 +360,7 @@
|
|||
<string id="39072">Läuft Kodi auf einem Raspberry Pi oder ähnlichem Gerät mit äusserst wenig Rechenleistung? Falls ja, wird die Rechenlast reduziert, damit Kodi nicht abstürzt.</string>
|
||||
<string id="39073">Tweaks Aussehen</string>
|
||||
<string id="39074">TV Serien</string>
|
||||
<string id="39075">Falls möglich, Plex Standard-Untertitel anzeigen</string>
|
||||
|
||||
<!-- Plex Entrypoint.py -->
|
||||
<string id="39200">Plex Home Benutzer abmelden: </string>
|
||||
|
|
|
@ -295,6 +295,7 @@ class PlayUtils():
|
|||
audioNum = 0
|
||||
# Remember 'no subtitles'
|
||||
subNum = 1
|
||||
defaultSub = None
|
||||
for stream in mediastreams:
|
||||
# Since Plex returns all possible tracks together, have to sort
|
||||
# them.
|
||||
|
@ -316,8 +317,6 @@ class PlayUtils():
|
|||
|
||||
# Subtitles
|
||||
elif type == "3":
|
||||
'''if stream['IsExternal']:
|
||||
continue'''
|
||||
try:
|
||||
track = "%s %s" % (subNum+1, stream.attrib['language'])
|
||||
except:
|
||||
|
@ -333,6 +332,10 @@ class PlayUtils():
|
|||
track = "%s - Forced" % track
|
||||
if downloadable:
|
||||
downloadableStreams.append(index)
|
||||
if stream.attrib.get('selected') == '1' and downloadable:
|
||||
# Only show subs without asking user if they can be
|
||||
# turned off
|
||||
defaultSub = index
|
||||
else:
|
||||
track = "%s (burn-in)" % track
|
||||
|
||||
|
@ -353,35 +356,35 @@ class PlayUtils():
|
|||
# Add audio boost
|
||||
playurlprefs['audioBoost'] = settings('audioBoost')
|
||||
|
||||
selectSubsIndex = None
|
||||
if subNum > 1:
|
||||
resp = dialog.select(lang(33014), subtitleStreams)
|
||||
if resp == 0:
|
||||
# User selected no subtitles
|
||||
playurlprefs["skipSubtitles"] = 1
|
||||
elif resp > -1:
|
||||
# User selected subtitles
|
||||
selectSubsIndex = subtitleStreamsList[resp-1]
|
||||
|
||||
if (settings('pickPlexSubtitles') == 'true' and
|
||||
defaultSub is not None):
|
||||
log.info('Using default Plex subtitle: %s' % defaultSub)
|
||||
selectSubsIndex = defaultSub
|
||||
else:
|
||||
resp = dialog.select(lang(33014), subtitleStreams)
|
||||
if resp > 0:
|
||||
selectSubsIndex = subtitleStreamsList[resp-1]
|
||||
else:
|
||||
# User selected no subtitles or backed out of dialog
|
||||
playurlprefs["skipSubtitles"] = 1
|
||||
if selectSubsIndex is not None:
|
||||
# Load subtitles in the listitem if downloadable
|
||||
if selectSubsIndex in downloadableStreams:
|
||||
|
||||
sub_url = self.API.addPlexHeadersToUrl(
|
||||
"%s/library/streams/%s"
|
||||
% (self.server, selectSubsIndex))
|
||||
log.info("Downloadable sub: %s: %s"
|
||||
% (selectSubsIndex, sub_url))
|
||||
listitem.setSubtitles([tryEncode(sub_url)])
|
||||
# Don't additionally burn in subtitles
|
||||
playurlprefs["skipSubtitles"] = 1
|
||||
else:
|
||||
log.info('Need to burn in subtitle %s' % selectSubsIndex)
|
||||
playurlprefs["subtitleStreamID"] = selectSubsIndex
|
||||
playurlprefs["subtitleSize"] = settings('subtitleSize')
|
||||
|
||||
else: # User backed out of selection
|
||||
pass
|
||||
|
||||
# Tell the PMS what we want with a PUT request
|
||||
# url = self.server + '/library/parts/' + self.item[0][part].attrib['id']
|
||||
# PlexFunctions.SelectStreams(url, playurlprefs)
|
||||
url += '&' + urlencode(playurlprefs)
|
||||
|
||||
# Get number of channels for selected audio track
|
||||
|
|
|
@ -81,11 +81,10 @@
|
|||
|
||||
<category label="30516"><!-- Playback -->
|
||||
<setting type="sep" />
|
||||
<setting id="bestQuality" type="bool" label="30541" default="false" />
|
||||
<setting id="bestTrailer" type="bool" label="30542" default="true" />
|
||||
<setting id="enableCinema" type="bool" label="30518" default="true" />
|
||||
<setting id="askCinema" type="bool" label="30519" default="false" visible="eq(-1,true)" subsetting="true" />
|
||||
<setting id="trailerNumber" type="slider" label="39000" default="3" visible="eq(-2,true)" range="1,1,15" option="int" />
|
||||
<setting id="pickPlexSubtitles" type="bool" label="39075" default="true" />
|
||||
<setting id="ignoreSpecialsNextEpisodes" type="bool" label="30527" default="false" />
|
||||
<setting id="offerDelete" type="bool" label="30114" default="false" visible="false"/>
|
||||
<setting id="deleteTV" type="bool" label="30115" visible="eq(-1,true)" default="false" subsetting="true" />
|
||||
|
@ -101,6 +100,8 @@
|
|||
<setting id="subtitleSize" label="39002" type="slider" option="int" range="0,30,300" default="100" />
|
||||
<setting id="failedCount" type="number" visible="false" default="0" />
|
||||
<setting id="networkCreds" type="text" visible="false" default="" />
|
||||
<setting id="bestQuality" type="bool" label="30541" default="false" />
|
||||
<setting id="bestTrailer" type="bool" label="30542" default="true" />
|
||||
</category>
|
||||
|
||||
<!--
|
||||
|
|
Loading…
Reference in a new issue