Merge pull request #417 from Electry/subs-extraction-fix

Don't force-extract subs for transcoded content
This commit is contained in:
mcarlton00 2020-11-04 22:45:31 -05:00 committed by GitHub
commit 711f2e1fcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -509,8 +509,13 @@ class PlayUtils(object):
mapping = {} mapping = {}
kodi = 0 kodi = 0
server_settings = TheVoid('GetTranscodeOptions', {'ServerId': self.info['ServerId']}).get()
for stream in source['MediaStreams']: for stream in source['MediaStreams']:
if stream['Type'] == 'Subtitle' and stream['DeliveryMethod'] == 'External': if stream['SupportsExternalStream'] and stream['Type'] == 'Subtitle' and stream['DeliveryMethod'] == 'External':
if not stream['IsExternal'] and not server_settings['EnableSubtitleExtraction']:
continue
index = stream['Index'] index = stream['Index']
url = self.get_subtitles(source, stream, index) url = self.get_subtitles(source, stream, index)
@ -593,6 +598,7 @@ class PlayUtils(object):
subs_streams = collections.OrderedDict() subs_streams = collections.OrderedDict()
streams = source['MediaStreams'] streams = source['MediaStreams']
server_settings = TheVoid('GetTranscodeOptions', {'ServerId': self.info['ServerId']}).get()
allow_burned_subs = settings('allowBurnedSubs.bool') allow_burned_subs = settings('allowBurnedSubs.bool')
for stream in streams: for stream in streams:
@ -614,9 +620,13 @@ class PlayUtils(object):
audio_streams[track] = index audio_streams[track] = index
elif stream_type == 'Subtitle': elif stream_type == 'Subtitle':
downloadable = stream['IsTextSubtitleStream'] and stream['IsExternal'] and stream['SupportsExternalStream'] if stream['IsExternal']:
if not downloadable and not allow_burned_subs: if not stream['SupportsExternalStream'] and not allow_burned_subs:
continue continue
else:
avail_for_extraction = stream['SupportsExternalStream'] and server_settings['EnableSubtitleExtraction']
if not avail_for_extraction and not allow_burned_subs:
continue
codec = self.get_commercial_codec_name(stream['Codec'], None) codec = self.get_commercial_codec_name(stream['Codec'], None)
@ -655,7 +665,6 @@ class PlayUtils(object):
if subtitle: if subtitle:
index = subtitle index = subtitle
server_settings = TheVoid('GetTranscodeOptions', {'ServerId': self.info['ServerId']}).get()
stream = streams[index] stream = streams[index]
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']: if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:
@ -674,8 +683,6 @@ class PlayUtils(object):
index = subs_streams[selection[resp]] if resp > -1 else source.get('DefaultSubtitleStreamIndex') index = subs_streams[selection[resp]] if resp > -1 else source.get('DefaultSubtitleStreamIndex')
if index is not None: if index is not None:
server_settings = TheVoid('GetTranscodeOptions', {'ServerId': self.info['ServerId']}).get()
stream = streams[index] stream = streams[index]
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']: if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']: